我试图更改接受按钮的颜色。这是我的代码。
let alert = UIAlertController(title: "Aviso",
message: "¿Desea eliminar el registro?",
preferredStyle: .alert)
//custome dialog
// Restyle the buttons of the Alert
alert.view.tintColor = UIColor.black
alert.view.backgroundColor = UIColor.yellow
// Accept button
let submitAction = UIAlertAction(title: "Aceptar", style: .default, handler: { (action) -> Void in
self.removePro()
})
// Cancel button
let cancel = UIAlertAction(title: "Cancelar", style: .destructive, handler: { (action) -> Void in })
// Add action buttons and present the Alert
alert.addAction(cancel)
alert.addAction(submitAction)
present(alert, animated: true, completion: nil)
答案 0 :(得分:0)
试试这个
submitAction.setValue(UIColor.blue, forKey: "titleTextColor")