Irfan Anwar
Irfan Anwar

Reputation: 1918

UINavigtionController Nib's Top Bar Black opaque not showing black on UIViewController

I have created new Storyboard Project in Swift and added UINavgationController to initial UIViewController then I changed color of Navigation Bar to black of UINavigationController from storyboard, but when I run the application its showing white color navigation bar.

Please note that I do not want programmatic solution to this issue. I need solution to this issue using storyboard only.

[UPDATE]

this is how I did from storyboard enter image description here

this is what I get in Simulator: enter image description here

Any help please?

Thanks

Upvotes: 2

Views: 532

Answers (3)

Irfan Anwar
Irfan Anwar

Reputation: 1918

I was using a left sliding menu library that was causing this issue. That library was overriding navigation bar that's why I was seeing white navigation.

Upvotes: 0

Artem Stepanenko
Artem Stepanenko

Reputation: 3526

I'm not sure what have you done in the storyboard. But this is what you can do to make it work:

  1. Select a navigation bar inside the navigation controller.

Navigation bar selection

  1. Pick the desired style.

enter image description here

UPDATE 1

Another solution would be to use appearance. Keep in mind, it will be applied to all navigation bars in the project.

[[UINavigationBar appearance] setBarTintColor:[UIColor blackColor]];
[[UINavigationBar appearance] setTranslucent:YES];

UPDATE 2

Or

[[UINavigationBar appearance] setBarStyle:UIBarStyleBlack];
[[UINavigationBar appearance] setTranslucent:YES];

UPDATE 3

If you really don't want to write any code, this is what you may do from the storyboard. Here 1 corresponds to UIBarStyleBlack.

enter image description here

Upvotes: 1

Maniganda saravanan
Maniganda saravanan

Reputation: 2198

Try setting Bar Tint color to BlackColor and uncheck Translucent.

enter image description here

Upvotes: 0

Related Questions