UIAlertAction color change

How to change the color of a UIAlertAction button added to a UIAlertController ?

+6
source share
2 answers

Pay attention to the following message:

Change text color of elements in UIActionSheet file - iOS 8

Although this is due to the color change of UIActionSheet elements, but one user responded according to the color of the change in UIAlertAction elements.

+3
source

No need to do some complicated things, you only need to change the tintColor property of the main UIAlertController view as follows:

 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 button tint will be red (or any other color)

+6
source

Source: https://habr.com/ru/post/979622/


All Articles