1

I have created an UIAlertController like this and I wanted to change the back button (action1) text color. How can I do it?

When I updated the code it worked but when the button is pressed the text became blue.

@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); 

}
Javi Rando
  • 115
  • 1
  • 10
  • 5
    Possible duplicate of [How to change UIAlertController button text colour in iOS9?](http://stackoverflow.com/questions/32856892/how-to-change-uialertcontroller-button-text-colour-in-ios9) – UditS Feb 07 '16 at 16:53
  • You are right, I didn't notice @UditS – Javi Rando Feb 07 '16 at 16:55

1 Answers1

6

Yes you can do that using this

alert.view.tintColor = UIColor.redColor() // your custom color
Vishnu gondlekar
  • 3,896
  • 21
  • 35