Hide the status bar

Source: Internet
Author: User
Tags uicontrol

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.