UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"请输入口令" message:@"" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确定",nil];
[alert setAlertViewStyle:UIAlertViewStyleSecureTextInput];
[alert show];
其中,只需要设置AlertViewStyle风格即可显示出不同风格弹出框:
| 添加一个普通输入框 |
| |
| |
获得alertView中文本框的方法:
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
UITextField *txt = [alertView textFieldAtIndex:0];
}