iOS 7 Status Bar Collides With NavigationBar

前端 未结 17 1264
攒了一身酷
攒了一身酷 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:52

    First, set UIViewControllerBasedStatusBarAppearance to NO in Info.plist. Then, in AppDelegate's application:didFinishLaunchingWithOptions: method add:

    if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7) {
       [application setStatusBarStyle:UIStatusBarStyleLightContent];
       self.window.clipsToBounds = YES;
       self.window.frame = CGRectMake(0, 20, self.window.frame.size.width, self.window.frame.size.height-20);
       self.window.bounds = CGRectMake(0, 20, self.window.frame.size.width, self.window.frame.size.height);
     }
     return YES;
    

提交回复
热议问题