How to prevent the status bar from showing if UIStatusBarHidden is YES?

Some users have reported that iOS 5 sometimes displays a status bar.

In my Info.plist, the UIStatusBarHidden key is YES, and I never communicate with the status bar in the code.

What can I do to fix this?

+6
source share
5 answers

the entries in Info.plist should be enough to hide it, but you can try to do this programmatically with

[[UIApplication sharedApplication] setStatusBarHidden:YES animated:NO]; 

when your application starts.

+6
source

I think the above method is deprecated in iOS5, I would use it instead:

 [[UIApplication sharedApplication]setStatusBarHidden:YES withAnimation:UIStatusBarAnimationNone]; 
+6
source

Found a solution!

I set the property to plist, but still got the status bar after pushing the view controller onto the navigation bar stack or opening UIImagePickerController: (I am using Xcode 4.2 (SDK 5.0) and iOS 5.0.1).

Here (put the code in every view controller that you don't need so that the status bar is visible):

Set self.wantsFullScreenLayout = YES; in

 - (id)initWithNibName: (NSString*)nibNameOrNil bundle: (NSBundle*)nibBundleOrNil 

call

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

in

 - (void)viewWillAppear: (BOOL)animated 

Then it works if the controllers are pressed through the navigation stack, and also using the UIImagePickerController (both removed or canceled).

Hope this helps.

+2
source

xcode 4.5 gives you a validation option to hide the status bar on the summary page

  • Go to the Project Purpose section.
  • Open sumaary, and then check the Hide StatusBar parameter.
+2
source

Do you use third-party structures that display the status bar?

+1
source

Source: https://habr.com/ru/post/904377/


All Articles