Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 522
Vasily Avatar asked Mar 23 '15 21:03

Vasily


People also ask

How do I change the color of the date picker?

Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project. Step 2 − Add the following code to res/layout/activity_main. xml. Kindly fine the highlighted code, this is the simplest way to change the colour of your datePicker.

What is Datepicker in Swift?

DatePicker is a control used in iOS applications to get the date and time values from the user. We can allow the user to either enter the time in point or time interval. class UIDatePicker : UIControl.


1 Answers

Still Works, Swift 4 Update

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

This works for me.

datePicker.setValue(UIColor.whiteColor(), forKeyPath: "textColor") 
like image 57
Sylvio LeBlanc Avatar answered Nov 13 '22 11:11

Sylvio LeBlanc