iOS 7 Status Bar Collides With NavigationBar

前端 未结 17 1323
攒了一身酷
攒了一身酷 2020-11-28 03:14

I have a view controller in my app that has a navigation bar dragged on it in the storyboard. It was working fine in the iOS 6 but in iOS 7 it look like this:

17条回答
  •  时光说笑
    2020-11-28 03:32

    In case it still helps someone, this is what worked for me for moving the Navigation Bar little bit down in ios 7 and above:

    -(void)viewWillLayoutSubviews
    {
        float iosVersion = 7.0;
        if ([[[UIDevice currentDevice] systemVersion] floatValue] >= iosVersion) {
            // iOS 7+
            CGRect viewFrame = self.view.frame;
            viewFrame.origin.y += 10;
            self.view.frame = viewFrame;
        }
    }
    

    On a device with ios 6.1 and below the Navigation Bar will be unchanged, as it was before.

    And this is what I used to make the contents of the Status Bar lighter:

    -(UIStatusBarStyle)preferredStatusBarStyle{
        return UIStatusBarStyleLightContent;
    }
    

提交回复
热议问题