Note that there are some explanatory texts on larger screens.

plurals
  1. PONavigationbar not repositioning after adding statusbar
    primarykey
    data
    text
    <p>I have a navigationbar-positioning problem that seems to have appeared with iOS6.<br> It acts in many ways similar to the proplem some users are experiencing when rotating some views</p> <p>The app has a splash screen, displayed full screen (achieved by setting <code>Hide statusbar during application launch</code> to <code>True</code>)</p> <p>Then in <code>viewDidLoad</code> in my Master View Controller the following line adds the statusbar back to the app:</p> <pre><code>[[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationNone]; </code></pre> <p>This adds the StatusBar to the app, and shifts the view downwards 20pt as expected. However, the NavigationBar stays put, underneath the StatusBar with a 20pt glitch underneath.</p> <p><img src="https://i.stack.imgur.com/VsmiC.png" alt="The glitch created by adding statusBar"></p> <p>Before iOS6 I used to fix this by adding the following line of code:</p> <pre><code>[UIApplication sharedApplication].keyWindow.frame=CGRectMake(0, 20, 320, [[UIScreen mainScreen] bounds].size.height-20); </code></pre> <p>Now, however, this do not work.</p> <p>Some research shows that at the time of calling <code>viewDidLoad</code>, <code>keyWindow.frame</code> has a size and origin both of {0,0}, and altering it has no effect.</p> <p>When inserting the two lines mentioned above to <code>viewDidAppear</code> I get the same behaviour when the app launches. When I dhen move to another view and back to the first view however, the alteration of <code>keyWindow.frame</code> has the desired effect and the NavigationBar ends up positioned where it should be.</p> <p>My question then: How to make the NavigationBar gets it's right position after adding the StatusBar to an iOS-app when the StatusBar is initially hidden?</p>
    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.
 

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