First, the basic application
Believe that the basic hidden methods online a lot, here is just a brief explanation
1?? Change the global status bar
1. Set Uiviewcontrollerbasedstatusbarappearance to No in the project's Info.plist file. That is, changing the state of StatusBar is not different with Uiviewcontroller.
2.[[UIApplication sharedApplication]setStatusBarHidden:YES];
2?? Managed by the Controller
1. Set Uiviewcontrollerbasedstatusbarappearance to Yes in the project's Info.plist file
2. Implement the following method in the controller
- (BOOL) prefersstatusbarhidden{ return YES;
Ii. problems that arise
The problem I was having was 2 of the above method. Can not hide the controller I want to hide the status bar, bitter search for a long time, finally at a meal at the time, figured out where the problem may be
Separately set Viewcontroller must be the highest level of Viewcontroller, (every top-level view controller in your app (others than a standard UIKit Contai NER view controller), which Apple officially told us. But what is the superlative?
The fact is: Our controller cannot be included in the other controller (the navigation controller is required to be the root controller), my project because the framework uses Swrevealviewcontroller. So if I want to hide the status bar of a controller in it, I have to hide the status bar of the controller when the view is about to appear, and then make it appear when the view is about to disappear.
I then added a bool property to the framework, and then called the Setneedsstatusbarappearanceupdate method to force a call to hide the status bar.
Problem solved perfectly!
The status bar for iOS development is hidden (problem)