【问题标题】:iOS double navigation bar by set translucent OFFiOS双导航栏通过设置半透明OFF
【发布时间】:2015-11-07 13:26:10
【问题描述】:


首先: 我使用故事板界面构建器...
我试着像 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。
但现在,我的问题是:如果我停用半透明并激活不透明并在我的外部设备上启动应用程序,导航栏下方是另一个导航栏。如果我再次将半透明切换到 ON,则不会显示第二个导航栏。 我该怎么办,第二个导航栏消失了?

【问题讨论】:

  • 你把这段代码放在哪里了?
  • 但是半透明的设置在我的故事板文件中发生了变化
  • 可以加截图吗?
  • 你是说我的故事板?
  • 问题截图!!!

标签: ios objective-c uinavigationbar navigationbar


【解决方案1】:

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

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

所以这个视图显示在导航栏下。我删除了这段代码,现在它可以工作了。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-03-10
    • 1970-01-01
    相关资源
    最近更新 更多