ios - How to set default text for addTextField in UIAlertController in Swift -


below the code tried. textfield.placeholder works perfectly, need set default text textfield created using addtextfield in uialertcontroller.

      let getpinnamealert = uialertcontroller(title: title, message: message, preferredstyle: .alert)       getpinnamealert.addtextfield(configurationhandler: { (textfield) -> void in       // textfield.placeholder = "pin name"       textfield.text = "current pin name"       textfield.keyboardtype = uikeyboardtype.default       textfield.clearsonbeginediting = true     }) 

remove line textfield.clearsonbeginediting = true

by default, alert automatically focuses on text field, why text set being cleared.


Comments

Popular posts from this blog

php - How to display all orders for a single product showing the most recent first? Woocommerce -

asp.net - How to correctly use QUERY_STRING in ISAPI rewrite? -

angularjs - How restrict admin panel using in backend laravel and admin panel on angular? -