Search code examples
ios6ios7statusbarnavbar

NavBar and StatusBar in iOS7 acts strange


If I have an "old" app with a NavBar and build it with iOS7, the StatusBar is visible together with the NavBar and it looks like a mess! And if I have a flip view (TransitionStyleFlipHorizontal), that TopBar is placed below the StatusBar and when turning back the view the window jumps up in an ugly way to cover the StausBar again. Do I have to reconstruct everything from scratch to make it look good. Just to make the StausBar stay on top of the NavBar? It must a simple way to fix that but how?


Solution

  • Write below code in your .m file.
    It basically help you to change location of navigation bar.

    -(void) viewDidLayoutSubviews
    {
        CGRect tmpFram = self.navigationController.navigationBar.frame;
        tmpFram.origin.y += 20;
        self.navigationController.navigationBar.frame = tmpFram;
    }