iOS 7 Status Bar Collides with Navigationbar

iOS 7 Status Bar Collides With NavigationBar

The latest version of the iOS has brought many visual changes and from a developer's point of view, the navigation and status bar are two noticeable changes.

The status bar is now transparent and navigation bar behind it shows through. The navigation bar image can even be extended behind the status bar.

First of all, if you are a beginner and have just started iOS development and are confused the way status bar and navigation bar is working, you can simply go through a blog post HERE that i found very useful. It has all the information related to navigation and status bar in iOS 7.

Now coming to the answer of your question. First of all i can see two different problems. One is that your status bar and navigation bar are both kind of colliding with each other as shown by you in the question with an image.

PROBLEM: Well the problem is that your have earlier dragged a navigation bar in your view controller which was working in iOS 6 correctly but with the arrival of iOS 7 SDK, this approach is resulting in status bar and navigation bar overlapping with each other.

SOLUTION to First Problem: You can either use UIBarPositionTopAttached or you can use view bounds and frames, i can also suggest and link you to Apple's documentation and bla bla bla but that would take some time for you to solve the issue.

The best and the most easiest way to solve this issue is to just embed your view controller inside a navigation controller and thats it. You can do it by just selecting the view controller and going to Editor > Embed In > Navigation Controller. (If there is any content on your old navigation bar, you can first drag it down, embed the view controller in navigation controller and then move the bar buttons on the new navigation bar and then delete the old navigation bar)

SOLUTION to Second Problem: This solution is for your specific question that you have mentioned in the update and is not for the general public reading this. As you can see that navigation and status bar is not visible and a transparent area is showing the parent view controller. I am not really use why you are facing this issue but most probably because of some third party library like ECSlidingView or any other is involved. You can select this view controller in your storyboard and set the background color of the view to be the same as your navigation bar. This will stop showing the parent view controller behind and your navigation bar and status bar will start showing. Now you can cover the rest of your view controller with text view or what ever your are using in it.

Hope this helps!

Letting the Navigationbar overlap the Statusbar in iOS 7

I've found a solution for this specific problem. Set the navigation bar's translucent property to NO:

 self.navigationController.navigationBar.translucent = NO;

Custom Navigation Bar image - iOS 7

Its because Navigation bar is 44 pixel in height and status bar is 20 pixel in height. In IOS7 the status bar is now transparent, that means the navigation bar behind it shows through. In some cases, the background image for a navigation bar can extend up behind the status bar.

if you hide status bar in your application you will find that the navigation bar will be smaller in height. This question has some nice discussion about this topic.

iOS 7 status and navigation bar different height in storyboard than in app

When you use Apple's Navigation controller which inserts a navigation bar, it will have different heights based on your orientation. For example, the navigation bar is 44 points in portrait and 32 points in landscape. In your case, I'm guessing when your app runs, it is in landscape, thus the "top layout guide" is y:52 (32+20).

See this related post: NavigationBar with rotation.

iOS 6 navigation bar is under status bar

So im not sure why, but i fixed the problem by manually moving the navigation bar down in my root view controller like so:

if( ! IS_OS_7_OR_LATER){

CGRect navFrame = self.navigationController.navigationBar.frame;
navFrame.origin.y += 20;
self.navigationController.navigationBar.frame = navFrame;
}

it seems to be something to do with my login view having a hidden nav bar, then my root view unhiding the nav bar, but im not sure exactly what. but luckily i only needed that code in the root view and it seemed to affect all subsequent views (probably because the status bar and nav bar are inferred in the storyboard)



Related Topics



Leave a reply



Submit