ez4nick
ez4nick

Reputation: 10199

UIDatePicker change font color ios15

I have a uiDatePicker and I had changed the font color previously with myDatePicker.tintColor = UIColor.red for example. Now that I have updated to Xcode 13 and ios15 when I run this on a device with ios15 the text color defaults to black and only changes to the set tint color when myDatePicker is selected and the calendar is shown. I would like for the text color to always be my set tint color and not just when the datepicker is selected. What is the correct way to accomplish this?

Upvotes: 3

Views: 2513

Answers (1)

bahadir arslan
bahadir arslan

Reputation: 4762

After research for hours I realized and accepted that there is no way to customize default UIDatePicker, even its font color. Before iOS 15 at least tint color was affecting the label color but they "fixed" at iOS 15.

So there is just one thing that you can do for changing font color to white is overriding dark mode

datePicker.overrideUserInterfaceStyle = .dark

Because of my background is totally black, this little trick solved my problem at acceptable level.

Source : Changing font color of Date Picker with inline style

Upvotes: 9

Related Questions