How do I change text color for one UIAlertAction in a UIAlertController and not all of the action buttons.
Here is my code for UIAlertController: I want to change Delete UIAlertAction text color to red.
//Alert to select more method
func moreAlert()
{
let optionMenu = UIAlertController(title: "Mere", message: "", preferredStyle: UIAlertControllerStyle.ActionSheet)
let Edit = UIAlertAction(title: "Rediger", style: .Default, handler: { action in
})
let Delete = UIAlertAction(title: "Slet", style: .Default, handler: { action in
})
let cancelAction = UIAlertAction(title: "Annullere", style: .Cancel, handler: { action in
print("Cancelled")
})
optionMenu.addAction(Edit)
optionMenu.addAction(Delete)
optionMenu.addAction(cancelAction)
self.presentViewController(optionMenu, animated: true, completion: nil)
}
Use the parameter style: .destructive
in the initializer for your Delete UIAlertAction
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