Using UIWebView to display select document types
In addition to HTML content, UIWebView can display specific document types.
iPhone OS 2.2.1 supports the following document types:
Excel (.xls)
Keynote (.key.zip)
Numbers (.numbers.zip)
Pages (.pages.zip)
PDF (.pdf)
Powerpoint (.ppt)
Word (.doc)
Listing 1: Loading a document into a UIWebView.
Listing 1: Loading a document into a UIWebView.
-(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];
posted on 2012-01-05 22:48 kiao295338444 阅读(285) 评论(0) 编辑 收藏 举报