【发布时间】:2013-11-15 18:46:49
【问题描述】:
我有这个 UIAlertview 带有我试图用来调用函数的标签。出现fogotpassword 警报视图,然后出现重置警报视图,但是当我尝试调用 NSLog(@"Password");通过按下重置警报视图中的第一个按钮来运行它不会被调用。相反,reset alertview 按钮再次弹出。我将不胜感激。
-(void)viewDidLoad{
forgotPassword = [[UIAlertView alloc] initWithTitle:@"Login Error"
message:@"Your login credentials do not match"
delegate:self
cancelButtonTitle:@"Try Again"
otherButtonTitles: @"Forgot Password",nil];
[forgotPassword show];
}
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
forgotPassword.tag = 1;
resetPassword.tag = 2;
if (buttonIndex == 1 && forgotPassword.tag ==1)
{
resetPassword = [[UIAlertView alloc] initWithTitle: @"Forgot Password"
message:@"Email" delegate:self
cancelButtonTitle:@"Cancel"
otherButtonTitles:@"Reset Password", nil];
[resetPassword setAlertViewStyle:UIAlertViewStylePlainTextInput];
[resetPassword show];
NSLog(@"RESET");
}
if (buttonIndex == 1 && resetPassword.tag == 2) {
NSLog(@"Password");
}
}
【问题讨论】:
标签: ios objective-c uialertview