[英]Hiding status bar iOS 7
Can't hide status bar on view controller on ios 7 device. 无法在ios 7设备上的视图控制器上隐藏状态栏。
Already tried setting through plist file and also in Appcontroller.mm but still i doesn't hide the status bar 已经尝试通过plist文件和Appcontroller.mm设置,但我仍然没有隐藏状态栏
[[UIApplication sharedApplication] setStatusBarHidden:YES];//Doesn't help
Go to info.plist and add two attributes if not present. 转到info.plist并添加两个属性(如果不存在)。 set "Status bar is initially hidden" to
YES
and set UIViewControllerBasedStatusBarAppearance
to NO
. 将“状态栏最初隐藏”设置为
YES
并将UIViewControllerBasedStatusBarAppearance
设置为NO
。 This will hide status bar for your app. 这将隐藏您的应用的状态栏。
That's because iOS 7 has changed the way it deals with the status bar. 那是因为iOS 7改变了它处理状态栏的方式。
Setting UIViewControllerBasedStatusBarAppearance
to NO
on your app Info.plist should work. 在应用程序Info.plist上将
UIViewControllerBasedStatusBarAppearance
设置为NO
应该可以正常工作。
I had the same issue recently. 我最近遇到了同样的问题。 Be sure that you are targeting the correct view controller.
确保您的目标是正确的视图控制器。 Try to hide the status bar in the root view controller.
尝试隐藏根视图控制器中的状态栏。 Also, I´m implementing the method
(BOOL)prefersStatusBarHidden
( doc ) in my UIViewControllers to hide the status bar. 另外,我在我的UIViewControllers中实现方法
(BOOL)prefersStatusBarHidden
( doc )来隐藏状态栏。 By using this method, you can forward the preferred configuration to a "child view controller". 通过使用此方法,您可以将首选配置转发到“子视图控制器”。 Also, this method works fine in UIViewControllers presented as modal.
此外,此方法在UIViewControllers中以模态形式呈现。
// for ios 7
- (BOOL)prefersStatusBarHidden
{
return YES;
}
// for ios 6
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
[[UIApplication sharedApplication] setStatusBarHidden:YES];
}
For iPad (iOS 7.0) need to put another value at Info.plist file. 对于iPad(iOS 7.0),需要在Info.plist文件中添加另一个值。
UIStatusBarHidden boolean value YES. UIStatusBarHidden布尔值YES。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.