IOS UIWebView初学者

来源:互联网 发布:js面试题及答案2016 编辑:程序博客网 时间:2024/05/21 07:10

/////////////////////////////这篇文章是搜集网上资料整理所的, 不是本人所写。

UIWebView是iOS sdk中一个最常用的控件。是内置的浏览器控件,我们可以用它来浏览网页、打开文档等等。

UIWebView主要有下面几个委托方法:

1、- (void)webViewDidStartLoad:(UIWebView *)webView;开始加载的时候执行该方法。
2、- (void)webViewDidFinishLoad:(UIWebView *)webView;加载完成的时候执行该方法。
3、- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error;加载出错的时候执行该方法。

- (void)webViewDidStartLoad:(UIWebView *)webView

{
    [activityIndicatorView startAnimating] ;
}
- (void)webViewDidFinishLoad:(UIWebView *)webView
{
    [activityIndicatorView stopAnimating];
}

- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error
{
    UIAlertView *alterview = [[UIAlertView alloc] initWithTitle:@"" message:[error localizedDescription]  delegate:nil cancelButtonTitle:nil otherButtonTitles:@"OK",nil];
    [alterview show];
    [alterview release];
}


0 0