swift - UIAlertController - Order of actions -


this question has answer here:

i wanna show alert window pressing on button. usual thing. i'm confused try show button "awesome" @ first, "cancel" button stay first. how can fix it?

let alert = uialertcontroller(title: "hello world", message: "testing", preferredstyle: .alert) let action = uialertaction(title: "awesome", style: .default){(_) in print("awesome")} let cancel = uialertaction(title: "cancel", style: .cancel, handler: nil)  alert.addtextfield(configurationhandler: nil) alert.addaction(action) alert.addaction(cancel)  alert.actions.foreach( { (action) in print( action.title! ) } )  present(alert, animated: true, completion: nil) 

irregular order of buttons

changing order not work default position of cancel button left.

change action style cancel button type uialertactionstyledefault instead of uialertactionstylecancel.


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

reflection - How to access the object-members of an object declaration in kotlin -

php - Doctrine Query Builder Error on Join: [Syntax Error] line 0, col 87: Error: Expected Literal, got 'JOIN' -