更改 UIAlertController 文本颜色

Jav*_*ndo 1 ios swift uialertcontroller

我创建了一个UIAlertController这样的,我想更改后退按钮(action1)的文本颜色。我该怎么做?

当我更新代码时,它起作用了,但是当按下按钮时,文本变为蓝色。

@IBAction func Horario(sender: AnyObject) {

    let alert = UIAlertController(title: "Horario de Apertura", message: "\(horario)", preferredStyle: UIAlertControllerStyle.Alert)
    let action1 = UIAlertAction(title: "Atrás", style: UIAlertActionStyle.Cancel, handler: nil)

    alert.view.tintColor = UIColor.redColor()

    alert.addAction(action1)

    self.presentViewController(alert, animated: true, completion: nil); 

}
Run Code Online (Sandbox Code Playgroud)

Vis*_*kar 6

是的,你可以用这个来做到这一点

alert.view.tintColor = UIColor.redColor() // your custom color
Run Code Online (Sandbox Code Playgroud)