How to hide navigation bar in iOS 7 specifically for cocos2D?
Asked Answered
P

2

10

My app is made with cocos2D 2.1, and I am using Xcode 5. After compiling, the UINavigationBar appears in my app on the top.

How can it be hidden? I have tried the other generic iOS 7 codes that seem to work for native iOS 7 Apps:

// None of the following works
navController_ = [[UINavigationController alloc] initWithRootViewController:director_];
navController_.navigationBarHidden = YES;
navController_.edgesForExtendedLayout = UIRectEdgeNone;
[navController_.navigationBar setTranslucent:NO];

if ([[CCDirector sharedDirector] respondsToSelector:@selector(edgesForExtendedLayout)])
    [CCDirector sharedDirector].edgesForExtendedLayout = UIRectEdgeNone;
Pelham answered 26/9, 2013 at 5:8 Comment(1)
best easy solution is.gd/FmHsf8Tacita
E
20

Set UIViewControllerBasedStatusBarAppearance to NO in the project's Info.plist.

Escalante answered 26/9, 2013 at 6:27 Comment(4)
I wrote that in my info.plist file but status bar is still visible. Can you please give descriptive answer?Sharlasharleen
@Sharlasharleen , the above key only basically only 'allows' the override of the status bar appearance, but makes no changes from the default, you must still set UIStatusBarHidden to YES in your info.plist, or [UIApplication sharedApplication].statusBarHidden = YES somewhere in your code, or make other changes to suit your needs.Escalante
On top of setting the info.plist setting, putting [self.navigationController setNavigationBarHidden: YES animated:YES]; in viewWillAppear: is the only way I could hide nav bar when using storyboard + ios7 transitioning segueTieratierce
In XCode, the name for this key is "View controller-based status bar appearance"Peckham
V
5

Add this(with spaces) to your info.plist:

View controller-based status bar appearance -> Value: NO

Villarreal answered 27/10, 2013 at 8:5 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.