动态隐藏状态栏
问题描述:
我想单击一个按钮来隐藏状态栏。我曾尝试过:动态隐藏状态栏
[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationFade];
我对此没有任何好运。我错过了什么吗?
答
简单的方法是,转到info.plist文件。添加行,“查看基于控制器的状态栏外观”并设置为NO。检查作为答案
答
如果你想这样做编程 试试这个。
覆盖的funtion
-(BOOL) prefersStatusBarHidden {
return needHideStatusBar;
}
-(IBAction) checkStatus {
// do your judgment here
needHideStatusBar = YES;
if ([self
respondsToSelector:@selector(setNeedsStatusBarAppearanceUpdate)]) {
[self performSelector:@selector(setNeedsStatusBarAppearanceUpdate)];
}
}
可能重复:http://stackoverflow.com/questions/18059703/cannot-hide-status-bar-in-ios7和http://stackoverflow.com/questions/ 19067899 /如何隐藏状态栏在编程方式在ios-7 – Aaron 2014-09-05 21:09:36
是的,我只是希望有另一种方式。 – Shawn 2014-09-05 21:29:55
查看此答案,以便在需要时进行更改:http://stackoverflow.com/a/18856079/772156 – hukir 2014-09-05 22:53:31