ios7状态栏隐藏与显示

来源:互联网 发布:linux test命令 编辑:程序博客网 时间:2024/05/22 09:49

今天在做项目的过程中碰到了隐藏状态栏的问题(IOS7.1),解决过程如下
在需要隐藏状态栏的视图控制器对应的viewDidLoad里面需要添加的代码如下:

if ([self respondsToSelector:@selector(setNeedsStatusBarAppearanceUpdate)]) {
     // iOS 7
    [self prefersStatusBarHidden];
    [self performSelector:@selector(setNeedsStatusBarAppearanceUpdate)];
}
- (BOOL)prefersStatusBarHidden
{
    return YES;//隐藏为YES,显示为NO
}




注:// This should be called whenever the return values for the view controller's status bar attributes have changed. If it is called from within an animation block, the changes will be animated along with the rest of the animation block.
- (void)setNeedsStatusBarAppearanceUpdate NS_AVAILABLE_IOS(7_0);

0 0
原创粉丝点击