【问题标题】:Rotate PDF page with usePageViewController使用 usePageViewController 旋转 PDF 页面
【发布时间】:2019-11-18 05:13:32
【问题描述】:

我正在使用 PDFKit 并尝试旋转页面。它旋转良好,但不使用 usePageViewController。使用 usePageViewController 它不会更新页面的框架。

// At defining PDFVIEW object
pdfView.displayMode = .singlePageContinuous
pdfView.usePageViewController(true, withViewOptions: nil)
// For rotating screen
pdfView.currentPage?.rotation += 90

没有 usePageViewController 分页不起作用。如何在同一个地方实现两者。

https://i.stack.imgur.com/xifjV.jpg

https://i.stack.imgur.com/HUogU.jpg

【问题讨论】:

    标签: swift ios-pdfkit


    【解决方案1】:

    你可以做一个技巧,它对我有用:)。 更改旋转集之前

        usePageViewController(false) 
    

    然后

        usePageViewController(true)
    
    guard let currentPage = self.pdfView.currentPage else {return}
    self.pdfView.usePageViewController(false)
    self.angle = self.angle + 90
    currentPage.rotation = self.angle
    self.pdfView.usePageViewController(true)
    self.pdfView.autoScales = true
    self.pdfView.go(to: currentPage)
    

    【讨论】:

    • 感谢您的回答。这工作正常。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-04-07
    • 1970-01-01
    • 1970-01-01
    • 2022-01-21
    • 2013-01-13
    • 1970-01-01
    相关资源
    最近更新 更多