Author Topic: How to Change the Text Color of a Date Picker  (Read 7564 times)

kjmcneish

  • Administrator
  • *****
  • Posts: 719
    • View Profile
How to Change the Text Color of a Date Picker
« on: June 05, 2015, 09:52:30 AM »
Although the date picker doesn't have a textColor attribute, it's actually very easy to change its text color (unlike the complex solutions involving protocols you usually see on the web).

Just use the date picker's setValue method which uses Key-Value Coding (KVC) to set attribute values. For example:

Code: [Select]
self.datePicker.setValue(UIColor.whiteColor(), forKey: "textColor")
All the best!
Kevin McNeish
Author of Learn to Code in Swift: https://itunes.apple.com/us/book/learn-to-code-in-swift/id942956811?mt=11
Check out our Robot Tic-Tac-Toe app: https://itunes.apple.com/us/app/robot-tic-tac-toe/id990638517?mt=8
« Last Edit: November 17, 2015, 11:23:46 AM by kjmcneish »