我在表格单元格中创建了日期对象的格式化显示,并使用 UIDatePicker 编辑这些值。
但我无法编辑文本的色调和背景颜色。
第一个屏幕截图是实际的意外结果:
第二个截图是想要的结果:
这是项目的链接:https://www.dropbox.com/sh/m74tnghpqeah8o7/AAA-rMlGe_mhqiuEkDhbApsUa?dl=0
最佳答案
@AziCode
在您的 func updateDatePicker() 中添加以下行,如果您想获得准确的颜色,请使用 RGB 颜色编码和 UiColor
targetedDatePicker.backgroundColor = UIColor.blueColor()
targetedDatePicker.setValue(UIColor.greenColor(), forKeyPath: "textColor")
targetedDatePicker.setValue(0.8, forKeyPath: "alpha")
并引用相同示例的链接和示例代码:- http://blog.deeplink.me/post/81386967477/how-to-easily-customize-uidatepicker-for-ios
关于ios - 如何自定义UIDatePicker并改变文字颜色和背景颜色?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31192463/