Implementation of Hiding Status Bar in IOS Development

  • 2021-11-01 05:01:33
  • OfStack

Implementation of Hiding Status Bar in IOS Development

Solution:

The following versions of IOS7 hide the methods of UIStatusBar:


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

Method after upgrading to iOS7:

Overload this method in UIViewController. h in the base class


- (BOOL)prefersStatusBarHidden NS_AVAILABLE_IOS(7_0); // Defaults to NO  
[objc] view plaincopyprint? 
- (BOOL)prefersStatusBarHidden  
{  
  // iOS7 Posterior ,[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationFade];  
  //  It doesn't work anymore   
  return YES;  
}  

Thank you for reading, hope to help everyone, thank you for your support to this site!


Related articles: