在 UIScrollView 上显示 PDF
我找到了一个示例代码,用于在水平滚动的 UIScrollView 上显示 PDF 文件。它工作正常,但问题是它仅显示 2 页 PDF。我尽我最大的努力去解决这个问题,但我无法解决。你能给我帮助吗?
I found an example code for showing PDF file on a UIScrollView with horizontal scrolling. It works fine, but problem is it shows only 2 pages of PDF. I tried in my best to figure out the issue, but I couldn't figure it. Can you please give me help?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我查看了您在这个问题中指出的示例项目,和您一样,我可以看到它只显示它要显示的任何 PDF 文件的两页。
示例代码的问题出现在 PDFViewController.m 文件中。对于这些行:
我添加了
这些新行到 PDFScrollView.h
和 PDFScrollView.m
这不是一个完美的修复。您会发现绘图不正确,尤其是在备份页面时。我将把它留给你作为一个练习来处理,但希望这是一个好的开始。
我希望它能帮助你。
I looked at that sample project you pointed to in this question and like you, I can see it only displays two pages of whatever PDF file it's given to display.
The problem with the sample code comes in the PDFViewController.m file. For these lines:
I added
And also these new lines into PDFScrollView.h
And PDFScrollView.m
This isn't a perfect fix. You'll see the drawing isn't proper, especially when backing up pages. I'll leave that to you as an exercise to take care of, but hopefully this is a nice start.
And I hope it helps you out.