繁体   English   中英

iOS双导航栏通过设置半透明关闭

[英]iOS double navigation bar by set translucent OFF


首先:我与情节提要界面构建器一起工作...
我试图给导航栏像Instagram一样上色:

UIColor *mainColorBlue = [UIColor colorWithRed:0.071 green:0.337 blue:0.533 alpha:1];

[[UINavigationBar appearance] setBarTintColor:mainColorBlue];
[[UINavigationBar appearance] setBackgroundColor:mainColorBlue];

但是,如果我将颜色设置为mainColorBlue,则不是此颜色。 我在互联网上读到,这是半透明的原因。 因此我将半透明设置为OFF。
但是现在,我的问题是:如果我停用半透明并激活不透明并在外部设备上启动应用程序,则导航栏下方是另一个导航栏。 如果我再次将半透明设置为“开”,则不会显示第二个导航栏。 我该怎么办,第二个导航栏消失了?

我解决了这个问题。
我在位置0,0上添加了一个子视图以为状态栏着色。

UIView *statusBarColor = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 64)];
statusBarColor.backgroundColor = mainColorBlue;
[self.view addSubview:statusBarColor];

因此,该视图显示在导航栏下方。 我删除了此代码,现在可以正常工作了。

暂无
暂无

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

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