Hide the status bar for iOS and the status bar for ios

Source: Internet
Author: User

Hide the status bar for iOS and the status bar for ios

When the system version is higher than iOS7.0, the original method of hiding the status bar may not be easy to use, because if you use the method of modifying plist to implement the hidden method, it still works.

Plist method:Key: Status bar is initially hidden value: YES since the program is enabled, the status bar has been hidden. key: View controller-based Status bar appearance value: YES after the program enters the status bar, the Status bar is hidden. (that is, the status bar is displayed when Default.png is displayed on the welcome screen) Code method:The disadvantage of the code method is that the status bar of the welcome screen cannot be hidden. because when the welcome screen is enabled, appDelegate has not executed didFinishLaunching. the advantage is that the status bar can be displayed in the specified ViewController. You only need to change "YES" of the Code to "NO ".
1-(BOOL) application :( UIApplication *) application didfinishlaunchingwitexceptions :( NSDictionary *) launchOptions {2 // Override point for customization after application launch. 3 if ([UIDevice currentDevice]. systemVersion. floatValue <7.0) {4 [UIApplication sharedApplication]. statusBarHidden = YES; 5} 6 else if ([self respondsToSelector: @ selector (setNeedsStatusBarAppearanceUpdate)]) 7 {8 // iOS7 and above 9 [self prefersstatushidbarden]; 10 // This is the display status of the update status bar. It only supports iOS7 and later versions. The use of javasmselector is to avoid affecting other work of the main thread. 11 [self defined mselector: @ selector (setNeedsStatusBarAppearanceUpdate)]; 12} 13 return YES; 14} 15 16-(BOOL) prefersStatusBarHidden17 {18 return YES; // hide as YES and display as NO19}

 

Related Article

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.