iOS13 UIKit 的 textColor 出现白色问题

iOS13 White Color issue with textColor of UIKit

在 iOS13 之前应用程序布局正常工作。苹果在 iOS13.1 中更新了最新的深色主题和浅色主题后,它们就是这样,现有应用程序面临许多问题。像 UITextField placeHolder 与 whiteColor 以前是 blackColor,UIDatePicker textColor 与 whiteColor 以前是 blackColor。

任何人都可以帮助我解决以下 DatePicker 文本颜色问题。这是不可见的,因为 whiteColor、TextColor 应该是 blackColor。

感谢任何帮助。 谢谢你。

这对你有帮助。

override func viewDidLoad() {
    super.viewDidLoad()
    if #available(iOS 13.0, *) {
        // Always adopt a light interface style.
        overrideUserInterfaceStyle = .light
    }
}

Swift 5 与 iOS 13

Common solution which is work for my whole application without perform any file specific changes.

Work for Xcode 11 or higher version, Build upload fail on prior version of Xcode 11.

在您的 info.plist 文件中将 UIUserInterfaceStyle 设置为 1

AppDelegate.swift

    if #available(iOS 13.0, *) {
        window?.overrideUserInterfaceStyle = .light
    } else {
        // Fallback on earlier versions
    }

We have to specify user interface style light for any existing application.