【问题标题】:Custom Timer Picker IOS Clock自定义定时器选择器 IOS 时钟
【发布时间】:2016-09-17 07:18:04
【问题描述】:

我想在 iOS 中自定义时钟应用程序的计时器选择器的外观(基本上它是一个带有计时器模式的 UIDatePicker)。我想更改选择器的文本颜色和边框线颜色,但根据文档,无法自定义外观。任何人都可以有自定义选择器的方法。 谢谢

【问题讨论】:

    标签: ios iphone ipad cocoa-touch uikit


    【解决方案1】:

    您可以自定义日期选择器,例如,

    目标 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")
    

    所以,你可以像这样自定义日期选择器的外观

    希望这会有所帮助:)

    【讨论】:

    • 感谢您的回答。此方法适用于 iPad,但不适用于 iPhone
    猜你喜欢
    • 2014-02-03
    • 2018-10-17
    • 2013-02-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-08-28
    相关资源
    最近更新 更多