How can one change the color of a UIAlertAction
button, that has been added to an UIAlertController
?
No need to do some complicated things, you only need to change the tintColor property of the UIAlertController main view like this :
let alert = UIAlertController(title: "Title", message: "Some message", preferredStyle: .Alert)
alert.view.tintColor = UIColor.redColor()
let action = UIAlertAction(title: "Ok", style: .Default, handler: nil)
alert.addAction(action)
This way your buttons tint will be red (or whatever color you want)
Refer following post:
Change Text Color of Items in UIActionSheet - iOS 8
Although it's related to changing color of UIActionSheet
items but one user has answered according to change color of UIAlertAction
items.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With