Rodrigo Parra
Rodrigo Parra

Reputation: 243

remove translucent bar in navigation bar created with storyboard

I created a navigationController from the storyboard and now i'm trying to remove it's translucent option

I've put this on my appdelegate.m

[[UINavigationBar appearance] setBarTintColor:[UIColor colorWithRed:52.0/255 green:152.0/255 blue:219.0/255 alpha:1]];
[[UINavigationBar appearance] setTintColor:[UIColor whiteColor]];

[[UINavigationBar appearance] setTranslucent:NO];

But this is crashing my app with a nonsense error, so I'm not sure if this is the right approach.

I have found this similar question but didn't solved my problem: Navigation Controller Transparent Bar Style is not working

But I'm not sure how to do that because I don't have a variable navController since I created my navigationController from the storyboard. How can I call the storyboard navigation controller programmatically and do something like that?

Thanks

Upvotes: 10

Views: 16216

Answers (3)

thomas
thomas

Reputation: 265

If you don't use storyboard, but IB, set the navigation bar style in MainWindow.xib to NOT translucent and set as color not the clear color.

Upvotes: 0

wibobm
wibobm

Reputation: 696

If you designed your view with a storyboard then you can solve the problem using XCode. Select the NavigationBar widget and uncheck "Translucent".

XCode 5

Upvotes: 13

blake305
blake305

Reputation: 2236

Add this to viewDidLoad on the first view controller appearing on the navigation stack:

self.navigationController.navigationBar.tintColor = [UIColor whiteColor];
self.navigationController.navigationBar.barStyle = UIBarStyleBlackOpaque;

Upvotes: 10

Related Questions