#import "PreViewController.h"
@interface PreViewController ()<UIWebViewDelegate>{
UIActivityIndicatorView *_indicatorView;
}
@end
@implementation PreViewController
- (void)viewDidLoad {
[super viewDidLoad];
UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 64, self.view.frame.size.width, ScreenHeight-64)];
//解析html
[webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:self.URL]]];
webView.delegate = self;
[self.view addSubview:webView];
_indicatorView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
[_indicatorView setCenter:self.view.center];
[self.view addSubview:_indicatorView];
}
- (void)webViewDidStartLoad:(UIWebView *)aWebView{
[_indicatorView startAnimating];
}
- (void)webViewDidFinishLoad:(UIWebView *)aWebView{
[_indicatorView stopAnimating];
}
- (void)webView:(UIWebView *)aWebView didFailLoadWithError:(NSError *)error{
[_indicatorView stopAnimating];
}
@end