在目标c中Wkwebview之前加载活动指示器



我正在使用wkwebview并在目标c中加载一个url。在加载wkwebview之前,我需要显示活动指示符。wkwebview有委托方法吗?

-(void)viewWillAppear:(BOOL)animated{
UIActivityIndicatorView *spinner = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
[spinner setCenter:CGPointMake(160,124)];
[self.view addSubview:spinner];
spinner.tag = 100;
[spinner startAnimating];

_homeWebView.opaque = true;
// http://ispatialtec.com/birdathon.php
_homeWebView.userInteractionEnabled = true;
[_homeWebView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.adbirdathon.ae/Birdathon/index.html"]]];
[spinner stopAnimating];
}

WKNavigationDelegate方法

- (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation

所以把你的旋转器移到那里。

最新更新