Labels and text inside Text Field becoming white automatically for iOS 13 Dark mode

£可爱£侵袭症+ 提交于 2019-12-07 06:19:56

问题


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 ?


回答1:


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.

Also you can eliminate the dark mode entirely by setting the UserInterfaceStyle on main window:

window!.overrideUserInterfaceStyle = .light

Note: Window where in AppDelegate until iOS 13, and now it is in SceneDelegate.




回答2:


if you are using System Color than it will automatically change in dark mode. so you can use Custom Color in Application.

Or you can set key User Interface Style and value Lightin Info.plist file.




回答3:


It's because your label's text color is set Default. In dark mode default color for text label is white and for view is black



来源:https://stackoverflow.com/questions/58061378/labels-and-text-inside-text-field-becoming-white-automatically-for-ios-13-dark-m

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!