首先:
我与 Storyboard界面构建器一起工作...
我尝试像 Instagram 一样为我的导航栏着色:
UIColor *mainColorBlue = [UIColor colorWithRed:0.071 green:0.337 blue:0.533 alpha:1];
[[UINavigationBar appearance] setBarTintColor:mainColorBlue];
[[UINavigationBar appearance] setBackgroundColor:mainColorBlue];
但如果我将颜色设置为 mainColorBlue,则不是这种颜色。我在互联网上读到,这是半透明的原因。所以我将半透明设置为关闭。
但是现在,我的问题是:如果我停用半透明并激活不透明并在我的外部设备上启动应用程序,则导航栏下方是另一个导航栏。如果我再次将半透明切换为 ON,则不会显示第二个导航栏。
我必须做什么,第二个导航栏消失了吗?
最佳答案
我解决了这个问题。
我在位置 0,0 上添加了一个 subview 来为状态栏着色。
UIView *statusBarColor = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 64)];
statusBarColor.backgroundColor = mainColorBlue;
[self.view addSubview:statusBarColor];
所以这个View显示在导航栏下面。我删除了这段代码,现在可以使用了。
关于iOS双导航栏通过设置半透明关闭,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33583254/