简体   繁体   English

当我将透明设置为否时,双击导航栏

[英]Double Navigation Bar when I set translucent to NO

When i set this code in viewDidLoad: 当我在viewDidLoad中设置此代码时:

[self.navigationController.navigationBar setTranslucent:NO];

and run the project in xcode, it creates other nav bar above of my main nav bar. 并在xcode中运行该项目,它会在我的主导航栏上方创建其他导航栏。

Anyone know what is it? 有人知道吗

[self.navigationController.navigationBar setBackgroundImage:[UIImage new]
                                                  forBarMetrics:UIBarMetricsDefault];
    self.navigationController.navigationBar.shadowImage = [UIImage new];
    self.navigationController.navigationBar.translucent = YES;
    self.navigationController.view.backgroundColor = [UIColor clearColor];

The code above set the nav bar from translucent to solid without hide or create an other nav bar. 上面的代码将导航栏从半透明设置为实体,而不会隐藏或创建其他导航栏。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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