iOS Hidden status bar

Source: Internet
Author: User

It is not easy to operate the top status bar after iOS, the following steps:

First add the View controller-based status bar appearance item in the Info.plist file,

One. The view controller-based status bar appearance item is set to Yes, the view controller has a priority setting of status bar higher than the application setting.

When the view Controller has a priority setting of status bar higher than the application setting, the status bar is hidden in the following way:

1. Call Setneedsstatusbarappearanceupdate in the View controller to update the display of the status bar.

-(void) Viewdidappear: (BOOL) animated{

[Super viewdidappear:animated];

if ([Self respondstoselector: @selector (setneedsstatusbarappearanceupdate)]) {

[Self Prefersstatusbarhidden];

[Self performselector: @selector (setneedsstatusbarappearanceupdate)];

}

}

2. The implementation of the Prefersstatusbarhidden of the view controller will be returned to Yes.

-(BOOL) Prefersstatusbarhidden

{

return YES;

}

Two. If the view controller-based status bar appearance is set to No, the Prefersstatusbarhidden method of the view controller is not valid, whichever is the application setting. is not to be called at all.

1. Use [[UIApplication sharedapplication] Setstatusbarhidden:yes Withanimation:no] to hide the status bar.

Because to be compatible with multiple system versions, I generally use method two

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.