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:
Change the app
tintColor
in the AppDelegate.func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject : AnyObject]?) -> Bool {
self.window.tintColor = UIColor.redColor()
return true
}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
Conditionally Hide Code from the Compiler
Ignore Manual Entries from Apple Health App as Data Source
How to Add Custom Text in Nsdateformatter's Format String
Apple Push Notification Service Server Certificate Update
Generate Rsa Public Key from Modulus and Exponent
Uitableview Pagination - Bottom Refresh to Load New Data in Swift
Facebook Registration:The Operation Couldn't Be Completed (Com.Facebook.Sdk Error 2)
Change Button Title Color in Uialertview
How to Release an Mtaudioprocessingtap
iOS Client Certificates and Mobile Device Management
Swift String Escaping When Serializing to JSON Using Codable
Ios7 App Backward Compatible with iOS5 Regarding Unique Identifier
The 'Pods' Target Has Transitive Dependencies That Include Static Binaries' When Installing Gcm
React-Native Loading Image Over Https Works While Http Does Not Work