2017-08-03 66 views
0

奇怪的問題。在Storyboard中設置的視圖的背景顏色無法正常工作?

當我從故事板設置背景顏色的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,則shwoing作爲下面: self.navigationBar.isTranslucent = false

enter image description here

我瞭解導航欄不同顏色的東西是由於是透明標誌。但是爲什麼從故事板和編程的背景顏色是不同的。

(從編程背景顏色是正確的)

版本的Xcode 8.3.3

enter image description here

+0

你如何讓色彩RGB值? –

+0

請分享如何設置RGB顏色 – Jaydip

+0

分享屏幕截圖從故事板中的顏色設置 –

回答

0

你可以把它正確的故事板(在模擬器和多設備測試)也是這樣的

只需在其中選擇Adobe RGB並在該框中粘貼您的十六進制顏色,然後完成!

如有問題請讓我知道..

enter image description here