UIAlertController *ctrl = [UIAlertController alertControllerWithTitle:@”提示” message:@”请输入交易密码” preferredStyle:UIAlertControllerStyleAlert];
[ctrl addTextFieldWithConfigurationHandler:^(UITextField * _Nonnull textField) {
textField.placeholder = @”请输入交易密码”;
textField.secureTextEntry = YES;
textField.keyboardType = UIKeyboardTypeNumberPad;
textField.delegate = self;
}];
[ctrl addAction:[UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:nil]];
[ctrl addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
UITextField * sureFiled = ctrl.textFields.firstObject;
NSString * tradePwd = sureFiled.text;
if (tradePwd.length==0) {
[SVProgressHUD show];
[SVProgressHUD dismissWithError:@”交易密码不能为空” afterDelay:2.0f];
return;
}
if (tradePwd.length>6 || tradePwd.length<6){
[SVProgressHUD show];
[SVProgressHUD dismissWithError: @”交易密码只能为6位数字” afterDelay:2.0f];
return;
}
}】;