With iOS 11, PDFKit has been made available in iOS. It has the capability of use a UIPageViewController but not to set the transition style ( documentation ).
Is there any way do change the transition style of the PageViewController of PDFView from the default to page curl?
I've gone through the view hierarchy of a PDFView and it seems like underneath it is using UIPageViewController. However, setting the transition style to curl is not possible as the property can only be set during initialization.
One workaround I tried, though inefficient when loading PDFs with large number of pages is to create your own UIPageViewController and set its view controllers on the datasource to view controllers each containing a PDFView whose page are set to the corresponding index.
let pageCount = self.pdfDocument!.pageCount - 1
for index in 0...pageCount {
let page: PDFPage = self.pdfDocument!.page(at: index)!
let pdfView: PDFView = PDFView(frame: self.view.frame)
pdfView.document = self.pdfDocument
pdfView.displayMode = .singlePage
pdfView.go(to: page)
pdfView.autoScales = true
let vc = UIViewController()
vc.view = aView
pages.append(vc)
}
Again this is a work around and perhaps there is a better way.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With