状态电池栏隐藏StatusBar状态

如果要设置全局

View controller-based status bar appearance : NO  

    [[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:NO];//此句代码才有效果

如果要设置针对某个界面
View controller-based status bar appearance : YES 

if ([self respondsToSelector:@selector(setNeedsStatusBarAppearanceUpdate)]) {
        
        //调用隐藏方法
        [self prefersStatusBarHidden];
        
        [self performSelector:@selector(setNeedsStatusBarAppearanceUpdate)];
        
    }

- (BOOL)prefersStatusBarHidden {
    return YES;
}

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