iOS状态栏重叠问题以及如何隐藏状态栏

一、状态栏重叠问题


1、在info.plist中新增 View controller-based status bar appearance 项并且将Value设置成 NO 这样状态栏就变成白字了。

2、在AppDelegate.m中加入下面的代码,判断系统版本然后将window的frame下拉20个像素

    if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7) {  
              
              
            self.window.frame =  CGRectMake(0,20,self.window.frame.size.width,self.window.frame.size.height-20);  
              
            UIApplication *myApp = [UIApplication sharedApplication];  
              
            [myApp setStatusBarStyle: UIStatusBarStyleLightContent];  
              
        }



二、隐藏状态栏

  

找到Info.plist文件

不但要在Info.plist中增加 Status bar is initially hidden一行,选择为 YES,

还需增加 View controller-based status bar appearance 一行,选择为 NO。


你可能感兴趣的:(iOS开发)