NSURL *url=[NSURL URLWithString:@"http://www.baidu.com"];
NSURLRequest *request = [[NSURLRequest alloc] initWithURL:url
cachePolicy:NSURLRequestReloadIgnoringLocalCacheData
timeoutInterval:2];
//timeoutInterval这个选项是加载链接时本地的超时时间,可以根据实际需求来设定这个时间
UIWebView* webView = [[UIWebView alloc]initWithFrame:self.view.bounds];
webView.delegate=self;
[webView loadRequest:request];
[self.view addSubview:webView];
}
#pragma mark - UIWebViewDelegate
-(void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error
{
N(@"测试!~~~");
}
网友评论