First, always hide the status bar
If the status bar is always hidden in the APP, you can use the <your_app>appdelegate application:didFinishLaunchingWithOptions: function, such as the following schematic code allows the status bar to fade out of the way to hide it:
-(BOOL) Application: (UIApplication *) application didfinishlaunchingwithoptions: (Nsdictionary *) launchoptions {//Override point for customization after application launch.[Application Setstatusbarhidden:no Withanimation:uistatusbaranimationfade]; //ADD The View controller ' s view to the window and display.[Self.window AddSubview:viewController.view]; [Self.window makekeyandvisible]; returnYES;}
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 <your_app>-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];
Instance:
- (void) viewdidload{[Super Viewdidload]; //additional setup after loading the view, typically from a nib.Flag=0; UIView*view =[[Uicontrol alloc]init]; View.backgroundcolor=[Uicolor Redcolor]; [(Uicontrol*) View addtarget:self action: @selector (touchpicture:) forcontrolevents:uicontroleventtouchupinside]; [View Setframe:cgrectmake (0,0, the,480)]; [Self.view Addsubview:view];}Second, the app will hide the status bar when it 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 <your_app>-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.
Set the status bar to hidden in info.plist
You can also modify it in text, add the Uistatusbarhidden key value to the root node, and set the value to true:
12<key>Uistatusbarhidden</Key><true/>
Third, hide or show the status bar during the run
Just like the method in the first paragraph, it can only be called from anywhere. Just use the static method of the UIApplication class Sharedapplication get the application instance.
IOS Hidden status bar