UIAlertAction with different color button text and image iOS swift

 Problem:

I want to create an alertviewcontroller that contains few actions.Also i want to set the text color as different.

Then every action i had with both image and text with tint color.

How can i achieve that?

Solution:

            let alertController = UIAlertController(title: "AppTitle",

                                                    message: "mess",

                                                    preferredStyle: .alert)

            let acceptAction = UIAlertAction(title: "Yes"style: .default) { _ in

                //Put your actions here

            }

            acceptAction.setValue(UIColor.blueforKey"titleTextColor")

            alertController.addAction(acceptAction)


Comments

Popular posts from this blog

Invalid bundle error while upload the app to the app Store

Convert NsNumber, NSDate to String in iOS Swift

Global LocationManager Singleton class iOS Swift