Set text color and font for UIDatePicker in iOS8/Swift

后端 未结 16 2216
囚心锁ツ
囚心锁ツ 2020-12-03 21:02

I\'ve been having trouble trying to set the UIDatePicker font and color. Everything else in my app was fairly straightforward to adjust except

16条回答
  •  情话喂你
    2020-12-03 21:19

    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:

提交回复
热议问题