对于iOS 13暗模式,“文本字段"中的标签和文本会自动变为白色 [英] Labels and text inside Text Field becoming white automatically for iOS 13 Dark mode
问题描述
我的应用程序在低于13.0的iOS版本上运行良好,但是当我将设备更新到iOS 13并选择了暗模式"时,标签会自动变为白色(之前为黑色),而在浅色"模式下情况则不是这样工作正常,黑色标签保持黑色).
My app works fine for iOS versions below 13.0 but when i updated the device to iOS 13 and chose Dark Mode, the labels are going white(which were black earlier) automatically which is not the case with Light mode (in which it is working fine, black labels remain black).
其他任何人都遇到过相同的情况,到目前为止,是否有任何解决方法?
Anyone else experiencing the same and is there any fix for the same so far ?
推荐答案
以前,UILabel
的default
颜色为Black Color
,但是自iOS 13起,默认值为LabelColor
witch是系统 UI中的语义颜色名称.元素颜色.要使其始终为黑色,请将颜色更改为black
(不是默认值).但是请注意,背景颜色可能会类似地从黑色变为黑色(从白色).
Previously the default
color of the UILabel
was Black Color
, but since iOS 13, the default value is LabelColor
witch is a Semantic Color name from system UI Element Colors. To make it always black, change the color to black
(not default). But be aware that the background color may change to black (from white) similarly.
还可以通过在主窗口上设置UserInterfaceStyle来完全消除黑暗模式:
Also you can eliminate the dark mode entirely by setting the UserInterfaceStyle on main window:
window!.overrideUserInterfaceStyle = .light
注意:该窗口位于AppDelegate
中,直到iOS 13,现在它位于SceneDelegate
中.
Note: Window where in AppDelegate
until iOS 13, and now it is in SceneDelegate
.
这篇关于对于iOS 13暗模式,“文本字段"中的标签和文本会自动变为白色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!