I am loading a view from xib using the Autolayout and Size classes. Inside this view there is a subview, viewWithSizeClasses , with a restriction on its height, which depends on the size class.
What I'm trying to do is load the constraints right after loadNibNamed to get the desired height according to the current size class.
I tried various combinations of layoutSubviews() , updateConstraints() , but no matter what I do, I always get Default Any, Any height.
override func viewDidAppear(animated: Bool) { super.viewDidAppear(animated) let xibView = NSBundle.mainBundle().loadNibNamed("View", owner: self, options: nil).first as View self.view.addSubview(xibView) height = xibView.viewWithSizeClasses.frame.size.height
I am deploying on iOS8 or later.
source share