【发布时间】:2016-09-17 07:18:04
【问题描述】:
我想在 iOS 中自定义时钟应用程序的计时器选择器的外观(基本上它是一个带有计时器模式的 UIDatePicker)。我想更改选择器的文本颜色和边框线颜色,但根据文档,无法自定义外观。任何人都可以有自定义选择器的方法。 谢谢
【问题讨论】:
标签: ios iphone ipad cocoa-touch uikit
我想在 iOS 中自定义时钟应用程序的计时器选择器的外观(基本上它是一个带有计时器模式的 UIDatePicker)。我想更改选择器的文本颜色和边框线颜色,但根据文档,无法自定义外观。任何人都可以有自定义选择器的方法。 谢谢
【问题讨论】:
标签: ios iphone ipad cocoa-touch uikit
您可以自定义日期选择器,例如,
目标 c:
targetedDatePicker.backgroundColor = [UIColor blackColor];
[targetedDatePicker setValue:[UIColor greenColor] forKey:@"textColor"];
[targetedDatePicker setValue:@"0.8" forKey:@"alpha"];
斯威夫特:
targetedDatePicker.backgroundColor = UIColor.blueColor()
targetedDatePicker.setValue(UIColor.greenColor(), forKeyPath: "textColor")
targetedDatePicker.setValue(0.8, forKeyPath: "alpha")
所以,你可以像这样自定义日期选择器的外观
希望这会有所帮助:)
【讨论】: