使用UIColor的RGB初始化方法没有得到预期的结果
...//
View.backgroundColor = UIColor(red:0.5,green:0.84,blue:0.99,alpha:1.0)
...// 并没有改变颜色
使用了网上的extension也未能解决这个问题,无法改变颜色是因为alertConroller的限制吗?有没有解决的办法呢
具体代码如下:
let alertController = UIAlertController(title: "\n\n\n",
message: "\n\n\n\n", preferredStyle: .alert)
let okAction = UIAlertAction(title: "好的", style: .default, handler: {
action in
print("点击了确定")
})
let subview = alertController.view.subviews.first! as UIView
let alertContentView = subview.subviews.first! as UIView
alertContentView.backgroundColor = UIColor()