2017-08-31 120 views
-1

我試圖改變接受按鈕的顏色。這是我的代碼。custome我的AlertController swift 3.0

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

我做的是我自己寫的呈現視圖控制器與_looks_像一個報警控制器的觀點,一個觀點。這樣,我可以做任何我喜歡的定製。 – matt

回答

0

試試這個

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