Uialertcontroller *alertcontroller = [Uialertcontroller alertcontrollerwithtitle:nil message:@ "Please enter the payment password" Preferredstyle:uialertcontrollerstylealert];
Add Cancel button;
[Alertcontroller addaction:[uialertaction actionwithtitle:@ "Cancel" Style:uialertactionstyledefault handler:^ ( Uialertaction * _nonnull action) {
}]];
Add the OK button;
[Alertcontroller addaction:[uialertaction actionwithtitle:@ "OK" Style:uialertactionstyledefault handler:^ ( Uialertaction * _nonnull action) {
Gets the 1th input box;
Uitextfield *usernametextfield = AlertController.textFields.firstObject;
NSLog (@ "Pay password =%@", usernametextfield.text);
}]];
Define the first input box;
[Alertcontroller addtextfieldwithconfigurationhandler:^ (Uitextfield * _nonnull TextField) {
Textfield.placeholder = @ "Please enter the payment password";
Textfield.securetextentry = YES;
}];
[Self Presentviewcontroller:alertcontroller animated:true completion:nil];
IOS Alertcontroller comes with an input box