s.d*_*.d. 1 objective-c uipickerview ios
我正在使用以下代码行更改UIPickerView整个应用程序的背景颜色,就像应用程序中的主题一样。这没有任何改变。
[[UIPickerView appearance] setBackgroundColor: [UIColor orangeColor]];
Run Code Online (Sandbox Code Playgroud)
我也尝试了以下行,但这给出了一个看起来很糟糕的奇怪阴影背景。
[[UIView appearanceWhenContainedInInstancesOfClasses:@[[UIPickerView class]]] setBackgroundColor: [UIColor darkGrayColor]];
Run Code Online (Sandbox Code Playgroud)
我希望背景颜色是一种纯色。
问题是,如何使用 更改UIPickerView整个应用程序的背景颜色UIAppearance?
小智 5
斯威夫特 3.0:
我设法使用这样的方法解决它func numberOfComponents (in pickerView: UIPickerView) -> Int:
func numberOfComponents(in pickerView: UIPickerView) -> Int {
pickerView.backgroundColor = UIColor.blackDark
return 1
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3980 次 |
| 最近记录: |