【发布时间】:2013-01-02 16:58:32
【问题描述】:
为什么这段代码不起作用?我只有这个:
-(void)_webview:(UIWebView *)_webview didFailLoadWithError:(NSError *)error {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error!" message:@"You have no internet connection!" delegate:self cancelButtonTitle:@"Close" otherButtonTitles:nil, nil];
[alert show];
}
- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex {
exit(0);
}
应该可以吧?
【问题讨论】:
-
doesn't work是什么意思,它会给出任何错误吗?你的 .h 文件中有<UIAlertViewDelegate>吗? -
另外,这与 Xcode 完全无关。
-
我的 h 文件中没有
。 -
@user1941966 要接收 UIAlertViewDelegate 调用,例如
didDismissWithButtonIndex:,您需要使用@interface myViewController : UIViewController <UIAlertViewDelegate>
标签: iphone uiwebview alertview