开发者

NetworkActivity indicator in webview

ive got a view based application containg a button clicking the button takes you to a web view..wat i want is the netwokActivityindicator to swirl..after finish loading of the web page i want the networkActivity indicator to disappear ...below is the code

-(IBAction)Button4

{

WebViewGive *newEnterNameController4 = [[WebViewGive alloc] initWithNibName:@"WebViewGive" 

bundle:[NSBundle mainBundle]];

 [[self navigationController] pushViewController:newEnterNameController4 animated:YES];

[newEnterNameController4 release];


}


- (void)viewDidLoad {
    [super viewDidLoad];

    [UIApplication sharedApplication].networkActivityIndicatorVisible=YES;
    self.urlAddress1 = @"http://www.youtube.com/user/stevenandkeirabanks";

    self.url1 = [NSURL URLWithString:urlAddress1];

    self.requestObj1 = [NSURLRequest requestWithURL:url1];

    [webViewAnnouncements loadRequest:requestObj1];

    }

if i m to use the network activity indicator below the

[webViewAnnouncements loadRequest:requestObj1];

I m jst getting a flickr and not the swrling of the ac开发者_Go百科tivity indicator


The simplest way to do this is to add this line after you instantiate your UIWebView.

[webView setDelegate:self];

Now you will call webViewDidStartLoad: and the entire method should look like this.

- (void)webViewDidStartLoad:(UIWebView *)webView
{
    [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:YES];
}

You can stop the network activity indicator as follows -

- (void)webViewDidFinishLoad:(UIWebView *)webView
{
    [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO];
}
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜