开发者

Animated Icon During Web page loading

开发者 https://www.devze.com 2023-04-11 12:22 出处:网络
I am creating an iOS app that displays a web view. How can I show an animated busy icon that shows a webpage 开发者_运维百科is still loading. The icon should of course disappear when the webpage is fu

I am creating an iOS app that displays a web view. How can I show an animated busy icon that shows a webpage 开发者_运维百科is still loading. The icon should of course disappear when the webpage is fully loaded. An example code would be nice to have.Thanks


OK, I figured out my own problem. For those of you who might want to know how to do this... UIWebView has a protocol called UIWebViewDelegate Protocol naming some methods that can be implemented optionally. To show an animated icon in the status bar while a web page is loading, simply implement the webViewDidStartLoad method. Something like this...

- (void)webViewDidStartLoad:(UIWebView *)webView {

    // starting the load, show the activity indicator in the status bar
    [UIApplication sharedApplication].networkActivityIndicatorVisible = YES;

}
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号