ios - 更改键盘替换的选取器 View 的背景颜色

标签 ios swift background uipickerview

所以我尝试过:

//1
buildPickers.layer.backgroundColor = UIColor(red: 255/255, green: 255/255, blue: 255/255, alpha: 0.3).CGColor

//2 
buildPickers.backgroundColor = UIColor(red: 255/255, green: 255/255, blue: 255/255, alpha: 0.3).CGColor

现在,这可以工作,但透明度不会生效,因为我认为有一个额外的背景 View 我没有编辑,作为键盘的一部分。

我已经像这样声明了选择器 View :

buildPickers = UIPickerView()

这里使用它:

buildText.inputView = buildPickers

有什么想法吗?

最佳答案

使用第二个选项,但没有.CGColor:

buildPickers.backgroundColor = UIColor(red: 255/255, green: 255/255, blue: 255/255, alpha: 0.3)

编辑:由于上述内容对您没有帮助,您是否考虑过使用“View UI Hierarchy”来调试您的 View ?

enter image description here

enter image description here

希望您觉得它有帮助。

关于ios - 更改键盘替换的选取器 View 的背景颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31834741/

相关文章:

ios - 如何在 iOS 6 中使用具有多个 subview 的现有自定义 View 自动布局

ios - 呈现 View Controller 会在其下方显示导航 Controller

macos - Swift IBOutlets 在 awakeFromNib 中为零(xcode 6.1.1 osx 10.10.1)

带有 Firebase 数据字符串的 Swift Firebase UIAlertView

ios - WatchKit 调用的定位服务在后台不工作

javascript - React Native TouchableHighlight 字体颜色文本更改

objective-c - 在我的 UITableView 中滚动时,单元格正在消失

ios - 如何在加载 View 时预先选择 UITableViewCell?

android - 在 Android 应用程序的后台播放音乐

wpf - 对作为窗口背景的图像的模糊效果