UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:nil message:@"此用户不存在" delegate:self cancelButtonTitle:@"关闭" otherButtonTitles:nil];
[alertView setTag: 10000];
[alertView show];
[alertView release];
//点击关闭的时候响应的函数
- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex {
if ([alertView tag] == 10000) { // it's the Error alert
if (buttonIndex == 0) { // and they clicked OK.
}
}
}
本文展示了一个使用UIAlertView显示错误消息的代码示例,并提供了当用户点击关闭按钮时如何处理的简单实现方式。
229

被折叠的 条评论
为什么被折叠?



