背景故事板中设置的视图的颜色无法正常工作?

时间:2017-08-03 07:46:40

标签: ios swift xcode storyboard uicolor

奇怪的问题。

当我从故事板为UIView,UILabel或UIButton设置背景颜色时,它显示如下

enter image description here

但是当我使用如下编程设置背景颜色时, customView.backgroundColor = //Same colour which I set in storyboard对于相同的观看次数,显示如下: enter image description here

检查相同RGB值的色差

此外,对于具有相同色调颜色和零背景图像的导航栏,它显示如下

self.navigationBar.setBackgroundImage(nil, for: .default) self.navigationBar.barTintColor = UIColor.nbRedColor()

enter image description here

当我将半透明属性设置为false时,它如下所示: self.navigationBar.isTranslucent = false

enter image description here

我理解导航栏不同颜色的东西是由于isTranslucent标志。但是为什么故事板和编程的背景颜色是不同的。

(编程的背景色是正确的)

Xcode版本8.3.3(在模拟器和多个设备中测试)

enter image description here

1 个答案:

答案 0 :(得分:1)

你可以在StoryBoard上使它正确也像这样

只需在其中选择Adobe RGB并将十六进制颜色粘贴到该框中即可完成!

如有任何问题请告诉我..

enter image description here

相关问题