预览功能
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
@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
相关文章推荐
- 峰回路转,Firefox 浏览器即将重返 iOS 平台
- 峰回路转,Firefox 浏览器即将重返 iOS 平台
- 不可修补的 iOS 漏洞可能导致 iPhone 4s 到 iPhone X 永久越狱
- iOS 12.4 系统遭黑客破解,漏洞危及数百万用户
- 每日安全资讯:NSO,一家专业入侵 iPhone 的神秘公司
- [转][源代码]Comex公布JailbreakMe 3.0源代码
- js兼容火狐显示上传图片预览效果的方法
- 在页面预览客户端本地图片的js代码(兼容FF IE)
- C#中的FileUpload 选择后的预览效果具体实现
- javascript 图片上传预览-兼容标准
- jsp中点击图片弹出文件上传界面及预览功能的实现
- 兼容IE和FF的图片上传前预览js代码
- javascript打印大全(打印页面设置/打印预览代码)
- 讲解iOS开发中基本的定位功能实现
- iOS中定位当前位置坐标及转换为火星坐标的方法
- js判断客户端是iOS还是Android等移动终端的方法
- iOS应用中UISearchDisplayController搜索效果的用法
- IOS开发环境windows化攻略
- iOS应用中UITableView左滑自定义选项及批量删除的实现