The status bar for iOS development is hidden (problem)

Source: Internet
Author: User

First, the basic application

Believe that the basic hidden methods online a lot, here is just a brief explanation

1?? Change the global status bar

1. Set Uiviewcontrollerbasedstatusbarappearance to No in the project's Info.plist file. That is, changing the state of StatusBar is not different with Uiviewcontroller.

2.[[UIApplication sharedApplication]setStatusBarHidden:YES];

2?? Managed by the Controller

1. Set Uiviewcontrollerbasedstatusbarappearance to Yes in the project's Info.plist file

2. Implement the following method in the controller

- (BOOL) prefersstatusbarhidden{    return  YES;

Ii. problems that arise

The problem I was having was 2 of the above method. Can not hide the controller I want to hide the status bar, bitter search for a long time, finally at a meal at the time, figured out where the problem may be

Separately set Viewcontroller must be the highest level of Viewcontroller, (every top-level view controller in your app (others than a standard UIKit Contai NER view controller), which Apple officially told us. But what is the superlative?

The fact is: Our controller cannot be included in the other controller (the navigation controller is required to be the root controller), my project because the framework uses Swrevealviewcontroller. So if I want to hide the status bar of a controller in it, I have to hide the status bar of the controller when the view is about to appear, and then make it appear when the view is about to disappear.

I then added a bool property to the framework, and then called the Setneedsstatusbarappearanceupdate method to force a call to hide the status bar.

Problem solved perfectly!

The status bar for iOS development is hidden (problem)

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.