1. Hide the status bar for a page
Add the method before the view is loaded into the window
-(BOOL) Prefersstatusbarhidden
{
Hide status bar in return yes;//ios7.0
}
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 { // Override point for customization after application launch. [Application Setstatusbarhidden:no Withanimation:uistatusbaranimationfade]; // ADD The View controller ' s view to the window and display. 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];
-(void// Do any additional setup after loading the view, Typically from a nib. 0 [[Uicontrol alloc]init]; view.backgroundcolor = [Uicolor Redcolor]; [(Uicontrol *0, 320, 480)]; [Self.view Addsubview:view];}
-(void) Touchpicture: (UIView *) sender{IF (flag = = 01else {[[uiapplication sharedapplication] Setstatusbarhidden:no Withanimation:uistatusbaranimationslide]; Flag = 0
Hide the status bar