First, always hide the status bar
If you want the status bar to be hidden in the app, you can set it in Appdelegate's application:didFinishLaunchingWithOptions: function, such as the following schematic code to hide the status bar from fading out:
-(BOOL) Application: (UIApplication *) application didfinishlaunchingwithoptions: (Nsdictionary *) launchOptions {
[Application Setstatusbarhidden:no Withanimation:uistatusbaranimationfade];
[Self.window AddSubview:viewController.view]; [Self.window makekeyandvisible]; return YES;}
Second, hide the status bar when the app starts
After using the above method, the app is actually hidden when it's running, but I found the status bar to be visible at the moment the app was launched, and then it flashed. Although the time is very short, it is still very uncomfortable to look at. To make the status bar hidden from the start, you can modify the-info.plist. If you modify in Xcode, add a new "Status bar is initially hidden" below the root node Infomation property list (you can choose it directly from the drop-down menu without entering it manually). This is a bool-type key value, and the check box in the Value column is checked.
Third, hide the status bar during running the program
[[UIApplication sharedapplication] Setstatusbarhidden:yes withanimation:uistatusbaranimationslide];
Hide the System status bar