Beginner Beginner - 10 months ago 78
iOS Question

How to change tint color of UIAlertController?

Can I change colors of the

? A standard color is a blue color. And it's much close to the standard iOS apps. If it's customizable? How can I change colors of this? For example a button color.



You could just change the tintColor of the underlying view, however, due to a known bug (, the tintColor is overridden by the application window's tintColor.

You can either:

  1. Change the app tintColor in the AppDelegate.

    func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject : AnyObject]?) -> Bool {
        self.window.tintColor = UIColor.redColor()
        return true
  2. Reapply the color in the completion block.

    self.presentViewController(alert, animated: true, completion: {() -> Void in
        alert.tintColor = UIColor.redColor()