码迷,mamicode.com
首页 > Web开发 > 详细

iphone之打开pdf、doc、xls文件用UIWebView

时间:2015-08-15 00:10:28      阅读:203      评论:0      收藏:0      [点我收藏+]

标签:

//文件名字及类型
NSString *path=[[NSBundle mainBundle]pathForResource:@"xls1" ofType:@"xls"];
//获取内容
NSData *data = [[NSData alloc]initWithContentsOfFile:path];
NSString *string = [[NSString alloc]initWithData:data encoding:NSUTF8StringEncoding];
NSLog(@"%@",string);

UIWebView *webView = [[UIWebView alloc]initWithFrame:CGRectMake(0, 55, 320, 300)];
webView.delegate = self;
webView.multipleTouchEnabled = YES;
webView.scalesPageToFit = YES;

NSURL *url = [NSURL fileURLWithPath:path];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
[webView loadRequest:request];

[self.view addSubview:webView];

iphone之打开pdf、doc、xls文件用UIWebView

标签:

原文地址:http://www.cnblogs.com/wcLT/p/4731459.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!