1

A lot of the answers I've seen to this question are either in Objective-C, hacky solutions, or solutions that don't answer the entire question.

I've been able to change the non-selected values colors using:

datePicker.setValue(UIColor.whiteColor(), forKeyPath: "textColor")

Is there a way to change the selected date's color and font from a UIDatePicker without being hacky?

10000RubyPools
  • 1,182
  • 3
  • 11
  • 24

3 Answers3

1

No. The only known way to change the color of the selected date in Swift (along with the rest of the text) is, indeed, hacky because making font/text color alterations to UIDatePicker isn't supported by the Human Interface Guidelines.

Community
  • 1
  • 1
Japes
  • 393
  • 5
  • 11
0

birthdayPicker.performSelector("setHighlightsToday:", withObject:UIColor.whiteColor())

CinCout
  • 9,486
  • 12
  • 49
  • 67
-2

Swift 4

datePicker.setValue(UIColor.white, forKeyPath: "textColor")

Amr Fawaz
  • 13
  • 2