0

如何在我的 iOS 应用程序中打开下载的文件(图像、pdf、word、excel 等)?有没有办法使用设备的系统工具(如 iBooks)打开它们,或者这应该在 UIWebView 中完成? 例子

4

2 回答 2

3

尝试这个

NSString* pdfFile = @""; //path of file here



NSURL *url = [NSURL fileURLWithPath:pdfFile];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
[webView setScalesPageToFit:YES];
[webView loadRequest:request];

[self.view addSubview:webView];
于 2013-10-30T04:52:21.403 回答
1

你可以使用QLPreviewController类。

苹果文档链接是https://developer.apple.com/library/ios/documentation/NetworkingInternet/Reference/QLPreviewController_Class/Reference/Reference.html

苹果说

A QLPreviewController object, or Quick Look preview controller, provides a specialized view for previewing an item.

编辑:

关于它的一个很好的教程:

http://iosdevelopertips.com/data-file-management/preview-documents-with-qlpreviewcontroller.html

于 2013-10-30T04:52:05.293 回答