【iOS】UIAlertView 点击跳转事件

iOS 开发中,UIAlertView 经常用到。这里记录下曾用到的点击跳转事件。

UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示"
                                                message:@"退出"
                                               delegate:self
                                      cancelButtonTitle:@"确认"
                                      otherButtonTitles:nil];
if ([@"请记住新密码" isEqualToString:result.msg]) {
    alert.tag=1;
}
[alert show];

UIAlertView 的点击事件(点击后跳转到其他页面):

- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
    if (alertView.tag == 1) {
        [self.navigationController popViewControllerAnimated:YES];
    }
}
原文地址:https://www.cnblogs.com/jaxer/p/4928160.html