Vasily Vasily - 9 months ago 73
Swift Question

Changing text color of datepicker

Is it any way to change text color of datepicker in iOS8? I've that it isn't possible in iOS7 and prior, something changed in 8th version?

For example I've found modified picker in Yahoo Weather!

enter image description here


Found solution at comments of stackoverflow. If you need just to change text color to yours and assign this subclass you your picker. For whiteColor works as magic.

Only minus i've found that color two lines of selected number is still gray.

class ColoredDatePicker: UIDatePicker {
    var changed = false
    override func addSubview(view: UIView) {
        if !changed {
            changed = true
            self.setValue(UIColor.whiteColor(), forKey: "textColor")