blog icon indicating copy to clipboard operation
blog copied to clipboard

How to set date color in UIDatePicker in iOS 13

Open onmyway133 opened this issue 5 years ago • 3 comments

datePicker.setValue(UIColor.green, forKey: "textColor")
datePicker.setValue(false, forKey: "highlightsToday")

In iOS 14

if #available(iOS 14.0, *) {
    datePicker.preferredDatePickerStyle = .wheels
    datePicker.tintColor = UIColor.green
}

Inspect attributes

  • https://developer.apple.com/documentation/objectivec/nsobject/1415656-attributekeys

onmyway133 avatar Dec 10 '19 13:12 onmyway133

Hello, iOS 16 doesn't changing todays date colour when I use the above code. Any inputs or workarounds?

rajasekhar-pasupuleti avatar Aug 12 '22 06:08 rajasekhar-pasupuleti

Hello, iOS 16 doesn't changing todays date colour when I use the above code. Any inputs or workarounds?

hello, have you resolve this question on iOS 16?

lilubin1992 avatar Sep 22 '22 12:09 lilubin1992

appDelegate.window?.overrideUserInterfaceStyle = .dark my App today alaways black. when I set dark mode the today textcolor change to white

huangzhengguo avatar Jun 27 '23 07:06 huangzhengguo