<分区>
如何更改已添加到 UIAlertController
的 UIAlertAction
按钮的颜色?
<分区>
如何更改已添加到 UIAlertController
的 UIAlertAction
按钮的颜色?
最佳答案
不需要做一些复杂的事情,你只需要像这样改变 UIAlertController 主视图的 tintColor 属性:
let alert = UIAlertController(title: "Title", message: "Some message", preferredStyle: .Alert)
alert.view.tintColor = UIColor.redColor()
let action = UIAlertAction(title: "Ok", style: .Default, handler: nil)
alert.addAction(action)
这样你的按钮就会变成红色(或者任何你想要的颜色)
关于ios - UIAlertAction 改变颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27484657/
相关文章:
ios - NSManagedObjectContext 无法删除其他上下文中的对象
ios - UIAlertController 因在 backgroundThread Objective-C 中出现而崩溃
ios - UIAlertController addTextFieldWithConfigurationHandler。奇怪的功能
objective-c - UIAlertController 将 leftBarButtonItem 向下移动
ios - Swift - UIAlertcontroller 中文本字段的大小
ios - 使用 swift 从中删除项目后,CollectionView indexPath 不更新
ios - iTunesConnect 要求我提交 "year-end self qualification report"