[IOS UIalert模版]

1.alertview创建

UIAlertView *alert;
        alert = [[UIAlertView alloc] initWithTitle:@"提示" message:@"题库有更新,需要更新吗?" delegate:self cancelButtonTitle:@"确定" otherButtonTitles:@"取消", nil];
        [alert setTag:1];
        [alert show];

2.回调函数

- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex {
   
    if ([alertView tag] == 1) {
        if (buttonIndex == 0) {     // and they clicked OK.
           //更新题库
        }
    }
    
}
原文地址:https://www.cnblogs.com/rayshen/p/3961218.html