swift - NSLayoutConstraints crashing on ios7 but not on ios8 -


I have a lack of layout in a UIViewController that works fine on ios8. But as soon as I iOS7 I went on got the following error: pre> *** assertion failure - [UIView layoutSublayersOfLayer:], /SourceCache/UIKit_Sim/UIKit-2935.137/UIView m: 8803

here is my code:

  class DatacenterIndicatorViewController: UIViewController {to sideMargins: float = 12.0 bridesmaid dataCenterPollingLabel: UILabel = UILabel () var dataCenterAlarmLabel : UILabel = UILabel () // Mark: - viewDidLoad function life cycle overrides () {super.viewDidLoad () self.view.addSubview (dataCenterPollingLabel) self.view.addSubview (dataCenterAlarmLabel)} override function viewDidLayoutSubviews () {super. viewDidLayoutSubviews () self.reloadData ()} reloadData function () {self.setupAlarmLabel () self.setupPollingLabel () self.generateConstraints ()} function setupPollingLabel () {// Some graphic setup} function setupAlarmLabel () {// Some graphic Setup} func generated consultants () {self.dataCenterPollingLabel.setTranslatesAu ToresizingMaskIntoConstraints (wrong) self.dataCenterAlarmLabel.setTranslatesAutermisingMaskIntoConstraints (wrong) self.view.addConstraint (item: DatacenterPolding label, attribute: NSLayoutAttribute.CenterY, related to: NSLayoutRelation.Equal, toItem : Selfkview, featuring: NSLayoutAttributekCenterY, multiplier: 1.0, constant: 0.0)) self.view.addConstraint (NSLayoutConstraint (item: DataCenterAlarmLabel, characterized : NSLayoutAttribute.CenterY, relatedBy: NSLayoutRelation.Equal, toItem: self.view, featuring: NSLayoutAttributekCenterY, multiplier: 1.0, constant: 0.0)) Self.view.addConstraint (item: Detasentralarm label, featuring: Anselautativet. With, Related: NSLayoutRelation.Equal, toItem: dataCenterPollingLabel, featuring: NSLayoutAttributekWidth, multiplier: 1.0, constant: 0.0)) self.view.addConstraints (NSLayoutConstraint.constraintsWithVisualFormat (NSString (format: "H: | - ==% F [DataCenterPollingLabel] - ==% F [DataCenterAlarmLabel] - Option: NSLayoutFormatOptionskallZeros, Matrix: Zero, scene [ "Detakentrpolding labeled" Detasentrpolinging label, "Detasentralarm labeled" Detasentalarm label]))}}  

What's wrong with my code? I also know where to look for some errors, everything looks good for me.

I've encountered the same iOS version 7 release calling self.view.layoutIfNeeded (in) super. ViewDidLayoutSubviews instead of function (function) at the end of the viewDidLayoutSubviews method resolves the problem.

code snippet

  override func viewDidLayoutSubviews () {// your statements self.reloadData () // function type statement down at the end of self.view Leautaifanideed ()}  

Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -