Cocos2d-x-iOS 7 hide Status Bar

Source: Internet
Author: User

1. Open the info. plist file under the Resources file.

2. Add a row in plist. The key is View controller-based status bar appearance and the value is set to NO (as shown below)



In this way, the status bar is hidden.


In addition, if the above method does not work, there are other methods on the Internet. (Ps: I have not tried it, because I can hide it according to the above method. Mark first)

2. If it doesn't work, in RootViewController. mm (Cocos2d-x project), add:

-(BOOL) prefersStatusBarHidden
{
Return YES;
}
3. Add the following code directly in RootViewController. mm (Cocos2d-x project:

-(Void) viewDidLoad

{

[Super viewDidLoad];

If ([self respondsToSelector: @ selector (setNeedsStatusBarAppearanceUpdate)])

{

[Self prefersStatusBarHidden];

[Self defined mselector: @ selector (setNeedsStatusBarAppearanceUpdate)];

}

Else

{

// IOS 6

[[UIApplication sharedApplication] setStatusBarHidden: YES withAnimation: UIStatusBarAnimationSlide];

}

}

-(BOOL) prefersStatusBarHidden

{

Return YES;

}




On the way to learning, I will share with you.

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.