在Swift中设置UIDatePicker的文本颜色 [英] Setting the text colour of a UIDatePicker in Swift

查看:106
本文介绍了在Swift中设置UIDatePicker的文本颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要将日期选择器的文本颜色设置为白色,我环顾四周,并尝试通过创建类型为"Color"的名为"textColor"的keyPath,然后设置颜色来进行设置可以,但是当前日期保持黑色.有人对此有解决方案吗?

I need to set the text colour of my Date Picker to white, i have had a look around and have tried to set it by creating a keyPath called "textColor" of type "Color" and then setting the colour, this works fine but the current date stays black. Does anyone have a solution for this?

推荐答案

我认为您正在搜索以下内容:

I think you are searching for this:

datePicker.setValue(UIColor.whiteColor(), forKey: "textColor")
datePicker.performSelector("setHighlightsToday:", withObject:UIColor.whiteColor())

这篇关于在Swift中设置UIDatePicker的文本颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆