我想根据我的应用程序主题更改我的警报 View 标题和按钮颜色,为此,我找到了以下许多解决方案:
alertController.view.tintColor = UIColor.red
但是上面的代码只改变了按钮标题的颜色,而不是警报标题。
使用 Xcode 9.1 在 iOS 11 上测试
最佳答案
使用以下代码更改警报标题:
alertController.setValue(NSAttributedString(string: "test", attributes: [NSAttributedStringKey.font : UIFont.boldSystemFont(ofSize: 15),NSAttributedStringKey.foregroundColor : UIColor.red]), forKey: "attributedTitle")
关于ios - 在 iOS 中更改 Alertview UIAlertController 按钮和标题颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47667001/