5

Before iOS13 application Layout working as excepted. After latest dark theme and light theme update by apple in iOS13.1, Their is so, many issue facing in existing application. Like UITextField placeHolder with whiteColor which are previously blackColor, UIDatePicker textColor with whiteColor which are previously blackColor.

Can anyone help me with below DatePicker text color issue. which are invisible because whiteColor, TextColor should be blackColor.

enter image description here

Any help appreciated. Thank you.

Pratik Sodha
  • 3,679
  • 2
  • 19
  • 38

2 Answers2

10

Swift 5 with 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.

Set UIUserInterfaceStyle to 1 in your info.plist file.

enter image description here

OR

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.

Pratik Sodha
  • 3,679
  • 2
  • 19
  • 38
  • 1
    if you include UIUserInterfaceStyle in your plist you app will be rejected by apple as stated here https://stackoverflow.com/questions/56546267/ios-13-disable-dark-mode-changes/56546554#56546554 – Benjamin Jimenez Sep 23 '19 at 19:48
  • Worked for me. You can upload the app correctly if you set UIUserInterfaceStyle to Light/Dark instead of int 1/0, if you set "1" uploader will fail. – Pelanes Oct 01 '19 at 10:08
  • That fixed it (even for flutter based project) – Bishoy Hanna Nov 16 '19 at 14:21
8

This could help you.

override func viewDidLoad() {
    super.viewDidLoad()
    if #available(iOS 13.0, *) {
        // Always adopt a light interface style.
        overrideUserInterfaceStyle = .light
    }
}
  • 11
    That’s a terrible idea. Your job is to adopt dark mode, not prevent it. – matt Sep 18 '19 at 06:08
  • @matt so it's better to have invisible text instead of this, while you work on dark mode support? – Aequitas Oct 09 '19 at 02:42
  • 1
    @Aequitas No law says you have to build against the iOS 13 SDK. But if you do, dark mode affects you, and you should deal with it properly. It's not difficult. If the OP had described how the picker was configured, I would have explained what to do so that the text would be visible in both dark mode and light mode. – matt Oct 09 '19 at 03:10