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

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -

javascript - oscilloscope of speaker input stops rendering after a few seconds -