ios 如何在Objective-C中显示PDF?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6369568/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-30 20:23:33  来源:igfitidea点击:

How to display a PDF in Objective-C?

objective-ciospdfpdf-reader

提问by meoden8x

How to read and display PDF in Objective-C?

如何在Objective-C中阅读和显示PDF?

回答by Morten Fast

If you just want to display it, the easiest way is to load it in a UIWebView.

如果你只是想显示它,最简单的方法是在一个 UIWebView 中加载它。

回答by Luke

If you want to solely read and display PDFs to users, as the Mail app does on your iOS device with all the scrolling and zooming done for you, then I would use a UIDocumentInteractionController.

如果您只想阅读和向用户显示 PDF,就像邮件应用程序在您的 iOS 设备上为您完成的所有滚动和缩放一样,那么我将使用 UIDocumentInteractionController。

http://developer.apple.com/library/ios/#documentation/uikit/reference/UIDocumentInteractionController_class/Reference/Reference.html

http://developer.apple.com/library/ios/#documentation/uikit/reference/UIDocumentInteractionController_class/Reference/Reference.html

You'll find some useful code in one of my recent questions, here:

你会在我最近的一个问题中找到一些有用的代码,在这里:

UIDocumentInteractionController crashing upon exit

UIDocumentInteractionController 在退出时崩溃

Hope this helps.

希望这可以帮助。

回答by Karsten

the easiset way is with the UIDocumentInteractionController

最简单的方法是使用UIDocumentInteractionController

Drawback: you need a local file-url

缺点:你需要一个本地文件 url