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 -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -