更改UIAlertController文本颜色

时间:2016-02-07 16:40:09

标签: 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); 

}

1 个答案:

答案 0 :(得分:4)

是的,你可以使用这个

来做到这一点
alert.view.tintColor = UIColor.redColor() // your custom color
相关问题