How to Change Tint Color of Uialertcontroller

How to change tint color of UIAlertController?

You could just change the tintColor of the underlying view, however, due to a known bug introduced in iOS 9 (https://openradar.appspot.com/22209332), 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.view.tintColor = UIColor.redColor()
    })

How to change the tint color of iOS system alerts?

This isn't possible, since the system manages the creation of these alerts. You can only specify the text in the permission alerts using the key-val pair in the info.plist file. This is probably restricted for consistent UI.

How to change UIAlertController button text colour in iOS9?

I've run into something similar in the past and the issue seems to stem from the fact that the alert controller's view isn't ready to accept tintColor changes before it's presented. Alternatively, try setting the tint color AFTER you present your alert controller:

[self presentViewController:strongController animated:YES completion:nil];
strongController.view.tintColor = [UIColor black];


Related Topics



Leave a reply



Submit