您的位置:首页 > 移动开发 > IOS开发

预览功能

2016-04-25 14:07 441 查看
#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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  预览 iOS