iPhone/iOS Status bar not hiding in Xcode project

两盒软妹~` 提交于 2019-12-08 14:56:11

问题


Hi I have tried the following but am unable to remove the status bar from my application:

  1. Set status bar is initially hidden to YES in plist
  2. 'Hide during application launch' to ticked in Project General settings
  3. Set status bar to 'none' in the interface builder file controlling view controllers
  4. Set [UIApplication sharedApplication].statusBarHidden = YES; in app delegate.

All these used to work fine in the 100 applications I did before but I made a recent xcode upgrade..

Is there some other secret way of getting rid of the status bar in the app? Do I need to journey to Apple headquarters and slay a red dragon ?


回答1:


Found the solution

In your apps plist file add a row call it "View controller-based status bar appearance" and set it to NO

SOURCE - OPENFL




回答2:


viewDidload

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

Add this method

- (BOOL)prefersStatusBarHidden
{
    return YES;
}


来源:https://stackoverflow.com/questions/22299214/iphone-ios-status-bar-not-hiding-in-xcode-project

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