2017-09-01 55 views
-3

狀態欄中文字的文字顏色不能改變。狀態欄背景顏色可以更改。我如何改變文字顏色?如何在狀態欄中輸入textcolor?

+0

可能對你有用[同問](https://stackoverflow.com/questions/17678881/how-to-change-status-bar-text-color-in-ios-7?rq = 1) –

回答

0

使用 -

UIApplication.shared.statusBarStyle = .lightContent // Light content, for use on dark backgrounds 

UIApplication.shared.statusBarStyle = .default // Dark content, for use on light backgrounds 

不要忘記在info.plist中編輯 「基於控制器的視圖狀態欄外觀」,並將其設置爲NO。

0

如何在狀態欄中輸入textcolor?

你不能!

,你唯一能做的事情就是改變UIStatusBarStyle,這可能是以下兩個選項之一:

  • default

一個黑暗的狀態欄,用於在明亮的背景上使用。

enter image description here

  • lightContent

一種光狀態欄,用於深色背景使用。

enter image description here

所以,如果你的目標是改變在狀態欄中的元素(在第一個屏幕和白色在第二個屏幕黑色)的顏色爲灰色 - 用於實例 - ,這將是不可能的,你必須堅持提到的兩個選項之一。


如何更改狀態欄的風格?

你可以檢查以下回答問題來實現它: