ios开发使用UIWebView显示多种文档

使用UIWebView示多种文档ios

 

除了HTML的内容,UIWebView能够示多种型的文档web

包括如下的app

·        Excel (.xls) ide

·        Keynote (.key.zip) url

·        Numbers (.numbers.zip) spa

·        Pages (.pages.zip) orm

·        PDF (.pdf) ip

·        Powerpoint (.ppt) ci

·        Word (.doc) 文档

·        Rich Text Format (.rtf)

·        Rich Text Format Directory (.rtfd.zip)

·        Keynote '09 (.key)

·        Numbers '09 (.numbers)

·        Pages '09 (.pages)

 

其中的rtfd是文档包的格式而且zip压缩,同时调时还应该保留文件后rtfd.zip

 

使用参照

 

-(void)loadDocument:(NSString*)documentName inView:(UIWebView*)webView

{

    NSString *path = [[NSBundle mainBundle] pathForResource:documentName ofType:nil];

    NSURL *url = [NSURL fileURLWithPath:path];

    NSURLRequest *request = [NSURLRequest requestWithURL:url];

    [webView loadRequest:request];

}

 

// Calling -loadDocument:inView:

[self loadDocument:@"mydocument.rtfd.zip" inView:self.myWebview];

 

 参考:

https://developer.apple.com/devcenter/ios/index.action

相关文章
相关标签/搜索