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)
changing order not work default position of cancel button left.
change action style cancel button type uialertactionstyledefault instead of uialertactionstylecancel.
Comments
Post a Comment