尝试设置 UIAlertController
backgroundColor
但结果是“褪色”颜色
let alert = UIAlertController(title: "some title", message: "(tap to continue)", preferredStyle: .Alert)
self.presentViewController(alert, animated: true, completion:{
let subview = alert.view.subviews.first! as UIView
let alertContentView = subview.subviews.first! as UIView
alertContentView.backgroundColor = UIColor.yellowColor()
我所说的“褪色”是指它不是亮黄色,而是更像褪色的黄色......
有什么想法吗?
最佳答案
想法?嗯,在 Apple 内部的层和 View 层次结构中的某个地方,有一些东西是半透明的。你可能会找到它是什么,但你正踏入危险的境地。苹果文档明确指出
You cannot customize the appearance of alert views.
所以即使你解决了这个问题,它也可能无法在所有 iOS 版本或所有设备上运行。如果您需要自定义外观,请不要使用警报 View ;创建您自己的模态视图。
关于ios - UIAlertController backgroundColor 褪色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37060042/