在iOS10中更改UIDatePicker TextColor

在iOS10中更改UIDatePicker TextColor,第1张

概述我有一种方法可以在10之前的iOS版本上更改UIDatePicker的文本颜色,但是对于iOS10,这些解决方案似乎不再起作用.如何恢复更改UIDatePicker的textColor的功能? if #available(iOS 10.0, *) { //Not sure of a way to do something similar here. } else { 我有一种方法可以在10之前的iOS版本上更改UIDatePicker的文本颜色,但是对于iOS10,这些解决方案似乎不再起作用.如何恢复更改UIDatePicker的textcolor的功能?

if #available(iOS 10.0,*) {        //Not sure of a way to do something similar here.   } else {        //The following lines change the textcolor of UIDatePicker to white in iOS9 and older.        self.setValue(UIcolor.white,forKey: "textcolor")        self.sendAction(Selector("setHighlightsToday:"),to: nil,for: nil)    }
解决方法 似乎没有任何改变,因为我甚至可以使用Swift 3实现它,如下所示.

import UIKitclass 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()    }}
总结

以上是内存溢出为你收集整理的在iOS10中更改UIDatePicker TextColor全部内容,希望文章能够帮你解决在iOS10中更改UIDatePicker TextColor所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1209483.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-04
下一篇 2022-06-04

发表评论

登录后才能评论

评论列表(0条)

保存