Hiding statusbar in iOS7

女生的网名这么多〃 提交于 2019-12-13 01:13:09

问题


I tried to hide status bar in iOS7 by putting this:

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

in delegate or in mainview

But it's not working!

It was working in iOS6


回答1:


Either set "View controller-based status bar appearance" to NO in your info plist or add this code in your view controllers:

-(BOOL)prefersStatusBarHidden
{
    return YES;
}



回答2:


Add the following to your Info.plist:

UIStatusBarHidden UIViewControllerBasedStatusBarAppearance

or follow this link http://www.openfl.org/developer/forums/general-discussion/iphone-5ios-7-cant-hide-status-bar/




回答3:


In a viewController where you want to hide status bar add:

- (BOOL)prefersStatusBarHidden
{
    return YES;
}

In viewDidLoad

    [self prefersStatusBarHidden];
    [self performSelector:@selector(setNeedsStatusBarAppearanceUpdate)];

In app *-info.plist

View controller-based status bar appearance set to YES




回答4:


Try this.

In your iOS target -> Info, add View controller-based status bar appearance and set the value as NO.

It worked for me in iOS7. I have also set "status bar initially hidden" property to YES




回答5:


//viewDidload
if ([self respondsToSelector:@selector(setNeedsStatusBarAppearanceUpdate)]) {
// iOS 7
[self prefersStatusBarHidden];
[self performSelector:@selector(setNeedsStatusBarAppearanceUpdate)];
} else {
// iOS 6
[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationFade];
}




// Add this Method
- (BOOL)prefersStatusBarHidden
{
return YES;
}

this wil work ..hope it helps




回答6:


In your apps plist file add a row call it " UIViewControllerBasedStatusBarAppearance" and set it to NO

from http://www.openfl.org/developer/forums/general-discussion/iphone-5ios-7-cant-hide-status-bar/, mgiroux's solution




回答7:


In the Plist add the following properties.

Status bar is initially hidden = YES

View controller-based status bar appearance = NO

now the status bar will hidden.



来源:https://stackoverflow.com/questions/18981256/hiding-statusbar-in-ios7

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!