Top Layout Guide won't start at top of screen in Xcode 6 storyboard - ios

I have 2 view controllers setup identically in a Storyboard. On one, the top layout guide goes all the way to the top (under the status bar), on the other the top layout guide starts just below the status bar.
On both view controllers, I have Extend Edges Under Top Bars (checked) and Adjust Scroll View Insets ->unchecked (not that I'm using a scroll view here).
I can't figure out why these are different in the storyboard, and thus at run time one view controller looks like the way it was designed, the other does not because items with constraints to that top layout guide will be 20px wrong.
Help.

Related

Navigation controller and ScrollView Top Layout Guide Margin

I am trying to align a "view" at the top of the screen but below the navigation bar. The view is inside a scrollview. The problem is that there is a gap at the top, where the top layout guide is not honored. I am writing this in Swift. Any solutions? I am attaching a photo of what's going on.
Basically, I want to remove the white part between the navigation controller and the blue background.
I also adding a snapshot of the constraints.

What is the proper way to add a view to a view controller and make it cover it completely through rotations using Auto Layout?

Say I have a UIViewController and I want to add a red UIView atop it that covers its view completely using Auto Layout.
My first instinct was to pin it to every edge of the view controller's view, but due to the iOS 7 nature of view controller views extending underneath the nav bars, pinning it with a constant of 0 doesn't put it under the nav bars. And if I put -64 to cover it in portrait, that's not the correct constant for landscape as the nav bar is shorter.
How should I be implementing this?
Make sure your view is pinned to the top of the super view, not the top layout guide. It sounds like it's currently pinned to the top layout guide.
If it is pinned to the top layout guide, the best way to fix it is to delete the constraint, select the view, click the "Pin" tool at the bottom right of IB, and then select the top with a setting of zero.
This works fine in Xcode 5.1.1, but was a little buggy in earlier versions. Control+Drag onto the view generally forces you to select the top layout guide instead of the top of the view.

Autolayout doesn't work?

So I'm creating my app in storyboard, and i'm using an navigation controller, added an add view, and trying to auto layout stuff there.
But the problem is, i only get blue guided lines when I'm near the corner left and right. So it's basically not looking at my Navigationbar above.. and just ignoring it.
Also, when I'm switching the simulator to a 3.5 inch (I'm making it in 4 inch) the buttons and labels will disappear underneath it. And they are added to Auto layout blue lines?
The blue lines are not AutoLayout, but just lines that guide you when placing your views. Auto Layout only comes in when you start adding constraints. Check out Apple's Autolayout guide:
https://developer.apple.com/library/ios/documentation/userexperience/conceptual/AutolayoutPG/Introduction/Introduction.html
Control drag from the label to the navigation bar and it will show the below window. The first option is for you to create the constraint from the Navigation Bar bottom.
The Top Layout Guide is a iOS 7 specific feature which marks the bottom line of the navigation bar. The total height of the navigation bar (if present) plus the height of the status bar (if present) equals the toplayoutGuide.length

ios 7 UINavigationBar is above content when using Auto Layout

I am using Auto Layout in a storyboard to position a UICollectionView. I have created a vertical spacing between Top Layout Guide and the CollectionView. But the collection view still starts underneath the navigation bar. Even the prototype cell also has extra padding. Please see images below.
Interface Builder:
Simulator View:
The content should start below the navigation bar but as the user scrolls the content should go under the navigation bar. How do I accomplish this?
In your storyboard go to View Controller properties, and make sure that Under Top Bars option is unchecked.
Also in most cases you want to have opaque navigation bar.

In Xcode 5 in a GLKViewController in IB what are the Top/Bottom Layout guides for?

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.
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.

Resources