IOS development-hide the status bar (battery bar)

Source: Internet
Author: User

IOS development-hide the status bar (battery bar)

There are two scenarios:

1. To hide the status bar of A view, for example, when interface A is pushed to interface B, interface A originally displays the status bar. However, interface B does not display the status bar.

At this time, you can do this:

Implement in B:

-(Void) viewDidLoad {[super viewDidLoad]; if ([self respondsToSelector: @ selector (listener)]) {// iOS 7 [self prefersStatusBarHidden]; [self callback mselector: @ selector (setNeedsStatusBarAppearanceUpdate)] ;}}-(BOOL) prefersStatusBarHidden {return YES; // hide as YES and display as NO}

In addition, add the following in the plist file:

Set key: View controller-based status bar appearance to YES



2. This is relatively simple. All views directly hide the status bar. It is also relatively simple.

(Set in plist ):
First, set key: Status bar is initially hidden to YES.
Then set key: View controller-based status bar appearance to NO
You can hide the status bar globally.

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.