SoFunction
Updated on 2025-04-04

Implementation method of hiding status bar in IOS development

Implementation method of hiding status bar in IOS development

Solution:

How to hide UIStatusBar in the following versions of IOS7:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions  
{  
  [application setStatusBarHidden:YES];  
  return YES;  
}  
 

How to upgrade to iOS7:

This method in overloading in the base class

- (BOOL)prefersStatusBarHidden NS_AVAILABLE_IOS(7_0); // Defaults to NO  
[objc] view plaincopyprint? 
- (BOOL)prefersStatusBarHidden  
{  
  // After iOS7, [[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationFade];  // It no longer works  return YES;  
}  

Thank you for reading, I hope it can help you. Thank you for your support for this site!