【问题标题】:Change the color of the lines in UIPickerView with Swift使用 Swift 更改 UIPickerView 中线条的颜色
【发布时间】:2015-04-18 15:45:21
【问题描述】:

基本上我只是想改变分隔线的颜色:

我认为对于 obj-c,这里有一个答案:link。但我很难用 Swift 翻译它。该怎么做?

【问题讨论】:

  • 别这样。如果 Apple 希望您能够修改/自定义 UIPickerView 的此功能,他们会为此提供 API。对内置接口类执行不受支持的修改可能会导致您的应用被 App Store 拒绝。
  • 没有答案,因为他们把图像放在前景上,但是你想要颜色,没有颜色
  • 感谢您的回答。所以这意味着 Apple 希望我只在浅色背景上使用 UIPickerView?
  • 难以置信...我们不能改变水平线的颜色?

标签: swift uipickerview


【解决方案1】:

[嗨]你可以这样做,

pickerView.subviews[1].backgroundColor = UIColor.white
pickerView.subviews[2].backgroundColor = UIColor.white

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-07-07
    • 1970-01-01
    • 1970-01-01
    • 2021-10-31
    • 1970-01-01
    • 2017-10-21
    相关资源
    最近更新 更多