大佬教程收集整理的这篇文章主要介绍了iOS应用程序在Xcode模拟器中运行良好,但速度很慢并且在设备上崩溃,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
该应用程序在设备上正常运行,直到最近添加了一些代码更改,这是我认为问题所在.我添加了包含可疑代码的整个viewDidLoad bellow(在代码中指出).
我注意到的另一件事是调试导航器中的cpu使用率大约为130%,而应用程序在设备上发生问题时在sim中运行.
override func viewDidLoad() { super.viewDidLoad() // screen size for collection view cell screenSize = UIScreen.mainScreen().bounds screenWidth = screenSize.width screenHeight = screenSize.height dimView.alpha = 0 openingHoursView.alpha = 0 resDescriptionLabel.layer.borderColor = UIColor.blackColor().CGColor resDescriptionLabel.layer.borderWidth = 2 resDescriptionLabel.layer.cornerRadius = 4 //add logo to nav bar let navBarlogo: UIImageView = UIImageView(frame: CGRectMake(0,120,36)) navBarlogo.image = UIImage(named: "logo") self.navigationItem.titleView = navBarlogo self.resImage.image = UIImage(named: "placeholder") if let checkedUrl = NSURL(String: "http://staging.api.cheapeat.com.au/restaurants/\(self.venuEID)/photo") { downloadImage(checkedUrl) } self.resName.text = " " + self.venuename + " " self.resAdd.text = " " + self.venueAdd + " " self.resPhone.text = "\(self.venuePH)" self.resPhonenumber.text = self.venuePH self.resWebText.text = "\(self.venueWeb)" ///////////////////// new code starts here ////////////// var paragraphStyle = NSMutableParagraphStyle() paragraphStyle.alignment = NSTextAlignment.Justified paragraphStyle.lineBreakmode = NSLineBreakmode.byWordWrapping var attributedString = NSAttributedString(String: self.venueInfo,attributes: [ NSParagraphStyleAttributename: paragraphStyle,NSBaselineOffsetAttributename: NSnumber(float: 0) ]) self.resDescriptionLabel.attributedText = attributedString aboutVenueLabelWidthConsTraint.constant = screenWidth - 16 resDescriptionLabel.edgeInsets.left = 10 resDescriptionLabel.edgeInsets.top = 10 resDescriptionLabel.edgeInsets.right = 10 resDescriptionLabel.edgeInsets.bottom = 10 resDescriptionLabel.layoutIfNeeded() BACkgroundImageHeightConsTraint.constant = resDescriptionLabel.bounds.height + 130 // set content view height i.e. scrollable area // (dynamic height of label + combined height of all other content and conTraints) contentViewHeightConsTraint.constant = resDescriptionLabel.bounds.height + 790 /////////////////// new code ends here /////////////// self.displaymap(self.venueLat,lng: self.venueLng) self.getArrayForCollection() self.getArrayValues() dispatch_async(dispatch_get_global_queue( DISPATCH_QUEUE_PRIORITY_DEFAULT,0),{ () -> Void in self.getDataForNextTable() }) mon.text = timeFormatTing(openingHours,day: "Monday") tue.text = timeFormatTing(openingHours,day: "Tuesday") wed.text = timeFormatTing(openingHours,day: "Wednesday") thu.text = timeFormatTing(openingHours,day: "Thursday") fri.text = timeFormatTing(openingHours,day: "Friday") sat.text = timeFormatTing(openingHours,day: "Saturday") sun.text = timeFormatTing(openingHours,day: "Sunday") }
以上是大佬教程为你收集整理的iOS应用程序在Xcode模拟器中运行良好,但速度很慢并且在设备上崩溃全部内容,希望文章能够帮你解决iOS应用程序在Xcode模拟器中运行良好,但速度很慢并且在设备上崩溃所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。