自定义我的AlertController swift 3.0

时间:2017-08-31 20:29:32

标签: swift3 uialertcontroller

我试图更改接受按钮的颜色。这是我的代码。

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)

1 个答案:

答案 0 :(得分:0)

试试这个

submitAction.setValue(UIColor.blue, forKey: "titleTextColor")