状态栏隐藏


Storyboard

界面上选中UIViewController,最右边Simulated Metrics找到 Status Bar 设定成 None

ViewController

iOS 6通过[UIApplication sharedApplication] 取得app的单例,然后调用setStatusBarHidden方法隐藏 Status Bar。

iOS 7

Info.plist

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

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

- (void)viewDidLoad {

    [super viewDidLoad];

    

    [[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationSlide];

    

    // Do any additional setup after loading the view.

}

如果想设置为现实则将hidden设置为no

[[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationSlide];



你可能感兴趣的:(ios,隐藏,状态栏,StatusBar)