预览功能

来源:互联网 发布:朗读爱好者软件 编辑:程序博客网 时间:2024/05/21 23:32



#import "PreViewController.h"


@interface PreViewController ()<UIWebViewDelegate>{

    UIActivityIndicatorView *_indicatorView;

    

}



@end


@implementation PreViewController


- (void)viewDidLoad {

    [superviewDidLoad];


    UIWebView *webView = [[UIWebViewalloc] initWithFrame:CGRectMake(0,64, self.view.frame.size.width,ScreenHeight-64)];

    //解析html

    [webView loadRequest:[NSURLRequestrequestWithURL:[NSURL URLWithString:self.URL]]];

    webView.delegate = self;

    [self.viewaddSubview:webView];

    

    _indicatorView = [[UIActivityIndicatorViewalloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];

    [_indicatorViewsetCenter:self.view.center];

    [self.viewaddSubview:_indicatorView];

    

}



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

    [_indicatorViewstartAnimating];

}


- (void)webViewDidFinishLoad:(UIWebView *)aWebView{

    [_indicatorViewstopAnimating];

}


- (void)webView:(UIWebView *)aWebView didFailLoadWithError:(NSError *)error{

    [_indicatorViewstopAnimating];

}

@end


0 0
原创粉丝点击