11

I'm testing my application with iOS7 and I have an issue with status bar. Basically the status bar appear over navigation bar like the image below:

iOS7 Status Bar Issue

I try to call in my viewDidLoad

 self.edgesForExtendedLayout = UIRectEdgeNone;
 self.automaticallyAdjustsScrollViewInsets = YES;

without success.

I have also added to the info.plist file UIViewControllerBasedStatusBarAppearance with no luck.

The main problem is that the application must be compatible with iOS6 and iOS7 and currently on iOS7 the view shifted 20px from the top.

rmtheis
  • 5,992
  • 12
  • 61
  • 78
PizzaRings
  • 171
  • 1
  • 1
  • 8
  • 2
    @Scott: http://meta.stackexchange.com/questions/94465/should-moderators-enforce-ndas-for-software-vendors – Aaron Brager Sep 10 '13 at 21:36
  • probably you are using a translucent navigationBar – Camo Sep 10 '13 at 22:45
  • i have this question as well http://stackoverflow.com/questions/18737186/position-of-navigation-bar-for-model-view-ios7 which after reading the answer below from Aaron gave me an idea and it worked. Will post my answer below – DogCoffee Sep 12 '13 at 00:00
  • can you use the black translucent on your status bar? – apollosoftware.org Sep 12 '13 at 01:14
  • I also had same issue while delivering build to client. I compile project using xcode 4.6 and installed same ipa on IOS 7 device. The client was happy with solution :) – Akshay Nalawade Oct 28 '13 at 10:06
  • @AkshayNalawade and what happens when you start doing your builds using xcode 5 you will still have the same issue. This isn't a solution your just delaying the overall outcome that will need to happen sooner are later. – Popeye Oct 28 '13 at 11:06
  • This isn't really an issue as it is the new iOS7 design. It is meant to appear under the status bar. all you need to do is increase the size of your navigation bar on iOS7. For my apps anything iOS6 and below the navigation bars are set to something like 44 and on iOS7 there set to something like 64. – Popeye Oct 28 '13 at 11:11
  • What I suggested was temporary solution. We will start making app UI IOS 7 and IOS 6 compatible by setting 'delta' for every controller. For now I don't have any other solution. will share if I came across anything. – Akshay Nalawade Oct 29 '13 at 05:39

4 Answers4

9

edgesForExtendedLayout and automaticallyAdjustsScrollViewInsets are just standards for how parent view controllers lay out / manage the view. It looks like you're using a UINavigationBar, but not a UINavigationController, which means these properties won't do anything unless you code them to.

You can switch to use a UINavigationController, or you can programmatically change the height of your UINavigationBar from 44 to 64 on iOS 7.

Aaron Brager
  • 65,323
  • 19
  • 161
  • 287
5

Add an outlet to the UINavigationBar.

float currentVersion = 7.0;

if ([[[UIDevice currentDevice] systemVersion] floatValue] >= currentVersion) {
    // iOS 7
    self.navBar.frame = CGRectMake(self.navBar.frame.origin.x, self.navBar.frame.origin.y, self.navBar.frame.size.width, 64);
}

You can also hide the status bar, this might be a better approach on these views to get more screen real estate.

I answered that here:

Position of navigation bar for modal view - iOS7

Community
  • 1
  • 1
DogCoffee
  • 19,820
  • 10
  • 87
  • 120
0

This is the biggest issue that comes with iOS 7 and there are many solutions to solve this but in my opinion, the best way to solve is to remove the navigation bar and embed your view controller in a navigation controller by going to Editor > Embed In Navigation Controller.

AJ112
  • 5,291
  • 7
  • 45
  • 60
0

Add constraints top space to top layout guide

enter image description here

Carmen
  • 6,177
  • 1
  • 35
  • 40