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.