ielyamani
ielyamani

Reputation: 18581

Set the font for UIDatePicker in iOS10 with Swift 3

Is there is a public interface to set the font for a UIDatePicker in Swift 3?

I am well aware that similar questions have been asked, mainly asking about how to change the color of labels inside a UIDatePicker.

Using something like datePicker.setValue(UIColor.someColor, forKey: "textColor") is accessing a private property, which could raise some eyebrows.

And using appearanceWhenContainedIn doesn't expose neither the label's textColor nor its font:

UILabel.appearance(whenContainedInInstancesOf: [UIDatePicker.self]).???

So, is there a formal way of changing the font of a UIDatePicker? Or should I build a date picker from scratch?

Upvotes: 0

Views: 1150

Answers (1)

matt
matt

Reputation: 534893

So, is there a formal way of changing the font of a UIDatePicker?

No, there isn't. That is exactly why all these workarounds are proposed.

Upvotes: 1

Related Questions