I am using new UIAlertController for showing alerts. I have this code:
// nil titles break alert interface on iOS 8.0, so we\'ll be using empty strings
UIAle
You can change the button color by applying a tint color to an UIAlertController.
On iOS 9, if the window tint color was set to a custom color, you have to apply the tint color right after presenting the alert. Otherwise the tint color will be reset to your custom window tint color.
// In your AppDelegate for example:
window?.tintColor = UIColor.redColor()
// Elsewhere in the App:
let alertVC = UIAlertController(title: "Title", message: "message", preferredStyle: .Alert)
alertVC.addAction(UIAlertAction(title: "Cancel", style: .Cancel, handler: nil))
alertVC.addAction(UIAlertAction(title: "Ok", style: .Default, handler: nil))
// Works on iOS 8, but not on iOS 9
// On iOS 9 the button color will be red
alertVC.view.tintColor = UIColor.greenColor()
self.presentViewController(alert, animated: true, completion: nil)
// Necessary to apply tint on iOS 9
alertVC.view.tintColor = UIColor.greenColor()