Completely resolve the IOS7 status bar hidden problem (and Setstatusbarhidden:yes does not work)

Source: Internet
Author: User
In general, adding the View controller-based status barappearance in Info.plist and setting the value to no allows you to freely control the hiding and displaying of the status bar in your program.
The problem is that the status bar color and the color of the interface does not match, then change the setstatusbarstyle on it.
But there is a situation, that is, when you open a photo album or camera, use the Uiimagepickercontroller, the status bar will be displayed, even if you hide it, it is transparent to show, but do not occupy the place, tried various methods can not hide out, Prefersstatusbarhidden also no avail.
Finally, the following methods are used to inherit a Uiimagepickercontroller subclass that controls the display and concealment of the status bar in each method of the subclass. Looks like this is a bug in iOS7.
@interface Ifimagepickercontrollerex:uiimagepickercontroller-(void) Viewdiddisappear: (BOOL) animated; -(void) Viewdidappear: (BOOL) animated; -(void) Viewwilldisappear: (BOOL) animated; @end
@implementation Ifimagepickercontrollerex-(void) Viewdidappear: (BOOL) animated {[superviewdidappear:animated]; [[Uiapplicationsharedapplication]setstatusbarstyle:uistatusbarstyledefault];     }-(void) Viewwilldisappear: (BOOL) animated {[superviewwilldisappear:animated]; [[Uiapplicationsharedapplication] Setstatusbarhidden:yes Withanimation:no];     }-(void) Viewdiddisappear: (BOOL) animated {[superviewdiddisappear:animated]; [[Uiapplicationsharedapplication] Setstatusbarhidden:yes Withanimation:no]; }

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.