在Stack Overflow上有很多关于这个问题的答案,但是似乎都不起作用。那么如何使UIAlertViewController的背景颜色真正透明呢?
我目前所使用的代码是:
let errorAlert = UIAlertController(title: "Title", message: "Message", preferredStyle: UIAlertControllerStyle.Alert)
let subview = errorAlert.view.subviews.first! as UIView
let alertContentView = subview.subviews.first! as UIView
alertContentView.backgroundColor = UIColor.clearColor()
errorAlert.view.backgroundColor = UIColor.clearColor()
showViewController(errorAlert, sender: self)
但结果会在图像上产生一种带有白色色调的透明背景...... 有没有办法去除这种有色背景?