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,就不是这个颜色了。我在互联网上读到,这是半透明的原因。所以我将半透明设置为关闭。
但是现在,我的问题是:如果我停用半透明并激活不透明并在我的外部设备上启动应用程序,则导航栏下方是另一个导航栏。如果我再次将半透明切换为 ON,则不会显示第二个导航栏。 我必须做的是,第二个导航栏消失了吗?

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

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

所以这个View显示在导航栏下面。我删除了这段代码,现在可以使用了。