我通过将QLPreviewController呈现给视图控制器来在Quicklook中显示本地pdf文件
func showFileWithPath(path: String){
let quickLookController = QLPreviewController()
quickLookController.dataSource = self
quickLookController.delegate = self
self.present(quickLookController, animated: true, completion: nil)
}
func numberOfPreviewItems(in controller: QLPreviewController) -> Int {
return 1
}
func previewController(_ controller: QLPreviewController, previewItemAt index: Int) -> QLPreviewItem {
let pdfURL = Bundle.main.url(forResource: "Mobile-Application", withExtension: "pdf", subdirectory: nil, localization: nil)
return pdfURL! as QLPreviewItem
}
在iOS 10中,quicklook工作正常。但是在ios 11中,工具栏被隐藏,工具栏按钮在左上方相互重叠。这可能是由于工具栏缺席。
为什么会这样?在ios 11中有没有人看到这个问题?