One of the screens in my app completely broke when updating to the iOS 8 SDK. The problem seems to be that the top layout guide shifts up instead of being an 'anchor' for the rest of the views.
This is what the view looked like on iOS 7:
This is what it looks like in iOS 8 (captured from the Xcode 6 View Hierarchy debugger):
As you can see, the view appears way above the navigation bar. There are two constraints on the top layout guide, one for the upper image view, and one for the white view below it. There are no constraints on the bottom layout guide, only height constraints on the views.
For some reason, iOS 8 decides to push the top layout guide to {0 -255; 0 0}
after [self.view layoutIfNeeded]
is called for the first time.
Also, the view's bounds sometimes appear too large for the device (i.e. showing up exactly as in the unified storyboard (600x600), instead of 320x480/320x568.
What has changed in iOS 8 that might screw up the layout?
[EDIT] Here is a complete list of the constraints on the view:
(lldb) po self.view.constraints
<__NSArrayM 0x786ac520>(
<NSLayoutConstraint:0x7c377bd0 V:[_UILayoutGuide:0x7c372f60]-(0)-[UIView:0x7c373120]>,
<NSLayoutConstraint:0x7c377c00 UIView:0x7c373120.width == UIView:0x7c3730b0.width>,
<NSLayoutConstraint:0x7c377c30 UIView:0x7c3730b0.centerX == UIView:0x7c373120.centerX>,
<NSLayoutConstraint:0x7c377c60 H:|-(0)-[UIView:0x7c3716f0] (Names: '|':UIView:0x7c3730b0 )>,
<NSLayoutConstraint:0x7c377c90 UIView:0x7c3716f0.width == UIView:0x7c3730b0.width>,
<NSLayoutConstraint:0x7c372f30 V:[_UILayoutGuide:0x7c372f60]-(129)-[UIView:0x7c3716f0]>
)
viewDidLoad
the bounds will still be whatever the storyboard sizes are (normally 600x600). The view's bounds will be correct inviewWillAppear
andviewDidAppear
, so save your frame/bounds updating code for those methods. – keithbhunter