iOS7 Status Bar over Navigation Bar

前端 未结 4 1612
感情败类
感情败类 2021-02-08 06:13

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:

相关标签:
4条回答
  • 2021-02-08 06:40

    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.

    0 讨论(0)
  • 2021-02-08 06:45

    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.

    0 讨论(0)
  • 2021-02-08 06:55

    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

    0 讨论(0)
  • 2021-02-08 07:00

    Add constraints top space to top layout guide

    0 讨论(0)
提交回复
热议问题