ios - Add a text field to UIAlertViewController in swift -


i'm new swift , have uialertviewcontroller , want add text field , data that. example text inside text field.

add text field alert controller:

alertcontroller.addtextfieldwithconfigurationhandler { (textfield) -> void in     textfield.placeholder = "some placeholder text"     // configure text field here } 

get text text field when user presses button:

let okaction = uialertaction(title: "ok", style: .cancel) { (action) -> void in      let textfield = alertcontroller.textfields![0] as! uitextfield } alertcontroller.addaction(okaction) 

Comments

Popular posts from this blog

xslt - Substring before throwing error -

Google Cloud Bigtable Durability/Availability Guarantees -

Android M doze mode and "native" posix socket freezing up -