UIAlertView - 使两个输入字段都安全

时间:2016-05-17 09:55:27

标签: ios objective-c uialertview

是否可以将UIAlertView的两种输入类型作为密码类型?
我正在实施更改密码功能,并想知道这是否可行。

UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Change password" message:nil delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Change password", nil];
alert.alertViewStyle = UIAlertViewStyleLoginAndPasswordInput;
[alert textFieldAtIndex:0].placeholder = @"New password";
[alert textFieldAtIndex:1].placeholder = @"Confirm password";
[alert show];

1 个答案:

答案 0 :(得分:2)

你去了:

[alert textFieldAtIndex:0].secureTextEntry = YES;
[alert textFieldAtIndex:1].secureTextEntry = YES;