IBOutlet UIWebView *webview;
.M
- (void)viewDidLoad {
[webview loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://blabla.com"]]];
}
- (void)webView:(UIWebView *)webViewfail didFailLoadWithError:(NSError *)error {
if([webViewfail isEqual:webview]) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Connection Failed"
message:@"Check your Internet connection before refreshing."
delegate:self
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
}
}
我不知道我做錯了什麼,我試圖使它出現,但掀起的互聯網連接。任何提示或建議將會有所幫助。
你有web視圖的委託設置爲'self'? – 2012-12-12 17:35:23
以防萬一 - IBOutlet連接到XIB中的對象? –