swift - How to change the specific button text colour programmatically in the UIAlertController -


i want changes colour of "cancel" button in uialertcontroller orange , keep colour of "log out" button is. have attached screenshot , code of alert controller below.

enter image description here

code alert view

alert = uialertcontroller(title: "", message: "are sure want 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.")       }) 

i have created custom alert in can make changes per our requirement.

i have attached github link


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -