ios - Display an Alert with Text Field Entry -


how display text entry field in alert input user , use input in application (display input on label ) ?

as showing below enter image description here enter image description here

thank time.

uialertcontroller *alert = [uialertcontroller alertcontrollerwithtitle:@"enter text"                                                                 message:@"enter text below"                                                          preferredstyle:uialertcontrollerstylealert];  uialertaction *submit = [uialertaction actionwithtitle:@"submit" style:uialertactionstyledefault                                                handler:^(uialertaction * action) {                                                     if (alert.textfields.count > 0) {                                                         uitextfield *textfield = [alert.textfields firstobject];                                                         textfield.text // text                                                    }                                                 }];  [alert addaction:submit];  [alert addtextfieldwithconfigurationhandler:^(uitextfield *textfield) {     textfield.placeholder = @"something"; // if needs }];  [self presentviewcontroller:alert animated:yes completion:nil]; 

Comments