Change UIDatePicker TextColor in iOS10

后端 未结 3 572
逝去的感伤
逝去的感伤 2021-01-14 18:24

I had a method of changing the UIDatePicker\'s text color on versions of iOS before 10, but with iOS10 those solutions no longer appear to work. How could I res

3条回答
  •  [愿得一人]
    2021-01-14 18:51

    Nothing seems to have changed because I am able to achieve it even using Swift 3 as shown below.

    import UIKit
    
    class ViewController: UIViewController
    {
        override func viewDidLoad()
        {
            super.viewDidLoad()
    
            let temp: UIDatePicker = UIDatePicker(frame: self.view.frame)
            temp.setValue(UIColor.purple, forKey: "textColor")
    
            view.addSubview(temp)
        }
    
        override func didReceiveMemoryWarning()
        {
            super.didReceiveMemoryWarning()
        }
    }
    

提交回复
热议问题