IOS Hidden status bar

Source: Internet
Author: User

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

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.