使用swift打开PDF文件 [英] Open PDF file using swift
本文介绍了使用swift打开PDF文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何为应用添加 PDF文件,点击按钮查看文件&当你完成后你会回到你所在的屏幕?
How can I add a PDF file for an app , where you click on a button to view the file & when you're done you get back to screen you were at?
推荐答案
如果您只是想查看PDF文件,您可以将其加载到UIWebView中。
If you simply want to view a PDF file you can load it into a UIWebView.
let url : NSURL! = NSURL(string: "http://developer.apple.com/iphone/library/documentation/UIKit/Reference/UIWebView_Class/UIWebView_Class.pdf")
webView.loadRequest(NSURLRequest(URL: url))
Swift 4.1:
let url: URL! = URL(string: "http://developer.apple.com/iphone/library/documentation/UIKit/Reference/UIWebView_Class/UIWebView_Class.pdf")
webView.loadRequest(URLRequest(url: url))
如果你想获得更多,一个好的框架是 PSPDFKit 。
If you'd like to achieve more, a good framework is PSPDFKit.
这篇关于使用swift打开PDF文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文