简体   繁体   中英

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在此处输入图片说明

this is what I get in Simulator: 在此处输入图片说明

Any help please?

Thanks

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.

导航栏选择

  1. Pick the desired style.

在此处输入图片说明

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 .

在此处输入图片说明

Try setting Bar Tint color to BlackColor and uncheck Translucent .

在此处输入图片说明

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM