Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You don't have to calculate how far to shift everything down, there's a build in property for this. In Interface Builder, highlight your view controller, and then navigate to the attributes inspector. Here you'll see some check boxes next to the words "Extend Edges". As you can see, in the first screenshot, the default selection is for content to appear under top and bottom bars, but not under opaque bars, which is why setting the bar style to not translucent worked for you.</p> <p>As you can somewhat see in the first screenshot, there are two UI elements hiding below the navigation bar. (I've enabled wireframes in IB to illustrate this) These elements, a UIButton and a UISegmentedControl both have their "y" origin set to zero, and the view controller is set to allow content below the top bar.</p> <p><img src="https://i.stack.imgur.com/rlC4S.png" alt="enter image description here"></p> <p>This second screenshot shows what happens when you deselect the "Under Top Bars" check box. As you can see, the view controllers view has been shifted down appropriately for its y origin to be right underneath the navigation bar.</p> <p><img src="https://i.stack.imgur.com/zYkIX.png" alt="enter image description here"></p> <p>This can also be accomplished programmatically through the usage of <code>-[UIViewController edgesForExtendedLayout]</code>. Here's a link to the class reference for <a href="https://developer.apple.com/library/prerelease/ios/documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/edgesForExtendedLayout">edgeForExtendedLayout</a>, and for <a href="https://developer.apple.com/library/prerelease/ios/documentation/UIKit/Reference/UIKitConstantsReference/Reference/reference.html#//apple_ref/c/tdef/UIRectEdge">UIRectEdge</a></p> <pre><code>[self setEdgesForExtendedLayout:UIRectEdgeNone]; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload