概述
该类可能是你在app中添加PDF功能时仅需处理的类,他可以让你显示PDF数据,允许用户选择内容,在文档中跳转,设置缩放级别,负责文本内容.他也会保存页面历史记录.
你可以通过继承PDFView来创建一个自定义的PDF界面.
或者用PDFKit的其他工具类,而根本不需要用PDFView.
话题
连接文档和界面
返回一个与PDFView关联的文档.
在文档中导航
是否能访问历史页中的前一页.
是否能访问历史页中的下一页.
是否能访问文档中首页.
是否能访问文档中的最后页.
是否能访问文档中的后一页.
是否能访问文档中的前一页.
当前页
var currentDestination: PDFDestination?
返回当前页中的当前点
在历史页中,向后跳转
在历史页中,向前跳转
跳转到文档首页
跳转到文档最后页
显示文档上一页
显示文档下一页.
滚到指定页.
到指定位置.
滚到选中区域的第一个字符.
func go(to: CGRect,on: PDFPage)
滚到页中的特定区域.
显示模型和特征
var displayMode: PDFDisplayMode
返回当前的显示模式.
是否分页显示.
当前显示盒的类型.
第一页是否显示成书的封面.
背景色.
设置委托
var delegate: PDFViewDelegate?
缩放界面
当前页面的缩放级别
是否设置了自动缩放
鼠标位置和事件
func areaOfInterest(forMouse: UIEvent)
返回鼠标经过区域的类型
func setCursorFor(PDFAreaOfInterest)
根据鼠标经过区域的类型设定鼠标类型.
执行指定的动作
选择处理
var currentSelection: PDFSelection?
func scrollSelectionToVisible(Any?)
func setCurrentSelection(PDFSelection?,animate: Bool)
var highlightedSelections: [PDFSelection]?
打印
func print(with: NSPrintInfo,autoRotate: Bool)
func print(with: NSPrintInfo,autoRotate: Bool,pageScaling: PDFPrintScalingMode)
view空间和PDFPage空间之间的转换方法
func page(for: CGPoint,nearest: Bool)
func convert(CGPoint,to: PDFPage)
func convert(CGRect,to: PDFPage)
func convert(CGPoint,from: PDFPage)
func convert(CGRect,from: PDFPage)
其它方法
func annotationsChanged(on: PDFPage)
常量
通知
static let PDFViewChangedHistory: NSNotification.Name
static let PDFViewDocumentChanged: NSNotification.Name
static let PDFViewPageChanged: NSNotification.Name
static let PDFViewScaleChanged: NSNotification.Name
static let PDFViewAnnotationHit: NSNotification.Name
static let PDFViewCopyPermission: NSNotification.Name
static let PDFViewPrintPermission: NSNotification.Name
static let PDFViewAnnotationWillHit: NSNotification.Name
用户点击了注释
static let PDFViewSelectionChanged: NSNotification.Name
选中区域发生了改变
static let PDFViewDisplayModeChanged: NSNotification.Name
static let PDFViewDisplayBoxChanged: NSNotification.Name
static let PDFViewVisiblePagesChanged: NSNotification.Name
static let PDFViewVisiblePagesChanged: NSNotification.Name
实例属性
var displayDirection: PDFDisplayDirection
var interpolationQuality: PDFInterpolationQuality
var isUsingPageViewController: Bool
var pageBreakMargins: UIEdgeInsets
var scaleFactorForSizeToFit: CGFloat
实例方法
func areaOfInterest(for: CGPoint)
func draw(PDFPage,to: CGContext)
func drawPagePost(PDFPage,to: CGContext)
func usePageViewController(Bool,withViewOptions: [AnyHashable : Any]? = nil)