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;
Irfan
  • 4,301
  • 6
  • 29
  • 46
Simon
  • 141
  • 1
  • 7

2 Answers2

20

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

Irfan
  • 4,301
  • 6
  • 29
  • 46
Mark
  • 876
  • 1
  • 7
  • 11
  • I wrote that in my info.plist file but status bar is still visible. Can you please give descriptive answer? – Renaissance Oct 10 '13 at 10:58
  • @Renaissance , 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. – Mark Oct 10 '13 at 17:14
  • 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 segue – Augie Oct 25 '13 at 00:15
  • In XCode, the name for this key is "View controller-based status bar appearance" – Claudiu Jan 26 '14 at 23:19
5

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

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

Irfan
  • 4,301
  • 6
  • 29
  • 46
sarfarazsajjad
  • 1,208
  • 2
  • 17
  • 30