Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ios 7 UINavigationBar is above content when using Auto Layout

Tags:

xcode

ios

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: enter image description here

Simulator View: enter image description here

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?

like image 276
Venkat S. Rao Avatar asked Oct 03 '13 03:10

Venkat S. Rao


People also ask

What is a uinavigationbar object?

A UINavigationBar object is a bar, typically displayed at the top of the window, containing buttons for navigating within a hierarchy of screens. The primary components are a left (back) button, a center title, and an optional right button.

What's new in auto layout for iOS?

Note: Auto Layout makes internationalization easy, too. You no longer have to make new XIBs or storyboards for every language you wish to support, including right-to-left languages such as Hebrew or Arabic. At first, Apple made one screen size for the iPhone.

What happens when the Superview changes size in auto layout?

As a result, when the superview changes size, the image view will be the one to resize, and the label will stay the same size. The T-bars should turn blue again and the Auto Layout warnings should have disappeared. Drag the green view into the main view’s top-left corner.

How do I change the navigation bar in UIViewController?

Configure the appearance of the navigation bar using the navigationBar property on the UINavigationController object. Control the content of the navigation bar by setting the title and navigationItem properties on each UIViewController you push onto the navigation controller’s stack.


1 Answers

In your storyboard go to View Controller properties, and make sure that Under Top Bars option is unchecked.

enter image description here

Also in most cases you want to have opaque navigation bar.

like image 141
interrupt Avatar answered Sep 28 '22 09:09

interrupt