Question

In Xcode 5 in a GLKViewController in IB what are the Top/Bottom Layout guides for? I've been reading through docs and can't seem to find it anywhere.

Was it helpful?

Solution

These are not specific to GLKViewController -- you'll see them in any view controller.

In iOS 7, views extend underneath the transparent status, navigation, and tab bars (if present) by default. Because you probably don't want your subviews ending up underneath these bars, the layout guides provide an easy way to set up layout constraints relative to wherever those bars end up.

For example, say you want a button to appear 20pt below the navigation bar. Where before you'd make a constraint between the button and the top of the view, you can now make a constraint between the button and the top layout guide. That view in the nib isn't responsible for setting whether the navigation bar is shown or how tall it is -- those things are controlled by the view controller that presents the view at run time -- so constraining to the top layout guide makes sure your button is in the right place regardless of how the view is presented.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top