【问题标题】:How does one change the colour of the text within UIDatePicker?如何更改 UIDatePicker 中文本的颜色?
【发布时间】:2019-09-07 23:14:52
【问题描述】:

我对 Swift 和 XCode 非常陌生。我在属性框中找不到更改 UIDatePicker 文本颜色的选项。我希望它是白色的,所以它会显示在深色背景上。

【问题讨论】:

    标签: swift xcode uidatepicker


    【解决方案1】:

    使用此代码

     yourDatePicker.setValue(UIColor.white, forKeyPath: "textColor")
    

    它将您的 datePicker 文本颜色更改为白色 如果您想更改为另一种颜色,只需将您的颜色替换为 UIColor.white

    【讨论】:

      猜你喜欢
      • 2015-01-14
      • 2022-07-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-02-20
      • 2014-01-19
      相关资源
      最近更新 更多