方法一
@property (nonatomic, strong) UIAlertView *passwordAlert;
@property (nonatomic, strong) UIAlertView *warningAlert;
passwordAlert = [[UIAlertView alloc] initWithTitle:@"Password" message:@"Enter password" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Done", nil];
passwordAlert.alertViewStyle = UIAlertViewStyleSecureTextInput;
[passwordAlert show];
-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
if (alertView == passwordAlert) {
// handle anything for password button indexes here
}
if (alertView == warningAlert)_ {
// handle anything for warning button indexes here
}
}
方法二