I've been having trouble trying to set the UIDatePicker
font and color. Everything else in my app was fairly straightforward to adjust except this. Does anybody know how to do this? I'm using Swift for iOS8.
Changing the date mode to something else seems to force a re-draw with the newly set text color.
datePicker.setValue(UIColor.whiteColor(), forKeyPath: "textColor") datePicker.datePickerMode = .CountDownTimer datePicker.datePickerMode = .DateAndTime //or whatever your original mode was
you just need to set 2 lines of code in viewdidLoad
/ viewWillAppear
accoding where you using DatePicker.
dobDatePicker.setValue(UIColor.whiteColor(), forKeyPath: "textColor") dobDatePicker.setValue(false, forKey: "highlightsToday")
See the Result like this:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With