I want to changes the colour of the "Cancel" button in UIAlertController to Orange and keep the colour of "Log Out" button as it is. I have attached the screenshot and the code of the alert controller below.
Code for the alert view
alert = UIAlertController(title: "", message: "Are you sure you want to log out?", preferredStyle: UIAlertControllerStyle.Alert)
alert.view.tintColor = UIColor.blackColor()
alert.addAction(UIAlertAction(title: "Log out", style: UIAlertActionStyle.Cancel, handler:{ (UIAlertAction)in
println("Log Out button clicked.")
prefs.setBool(false, forKey: "Isloggedin")
NSUserDefaults.resetStandardUserDefaults()
prefs.setBool(true, forKey: "IsEmail")
prefs.setObject(email, forKey: "loggedemail")
prefs.synchronize()
let mainview = self.storyboard?.instantiateViewControllerWithIdentifier("mainscreen") as! mainViewController
self.navigationController?.pushViewController(mainview, animated: true)
}))
//alert.view.tintColor = UIColor.yellowColor()
alert.addAction(UIAlertAction(title: "Cancel", style: UIAlertActionStyle.Default, handler:{ (UIAlertAction)in
println("Cancel button clicked.")
}))
self.presentViewController(alert, animated: true, completion: {
println("completion block.")
})