IOS 11 PDFKit - Transition to Curl

With iOS 11, PDFKit was available on iOS. It has the ability to use the UIPageViewController, but not set the transition style ( documentation ).

Is there a way to change the transition style of the PageViewController PDFView control from the default to page curl?

+8
ios pdf swift ios11
source share
1 answer

I looked through the PDFView view hierarchy and it looks like it is using the UIPageViewController. However, setting the transition style for curling is not possible, since the property can only be set during initialization.

One workaround that I tried, although ineffective when loading PDF files with a large number of pages, is to create my own UIPageViewController and configure its view controllers to a data source to view controllers, each of which contains a PDFView whose page is set to the appropriate 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 work and perhaps the best way.

+2
source share

All Articles