iOS 在 PDF/ePub 阅读器上的页面之间逐渐滑动
我有一个滑动手势,可以立即更改 ePub/PDF 页面之间的页面。它使用 UIWebView 来显示页面,并使用 [_webview loadRequest:[NSURLRequest requestWithURL:[NSURL fileURLWithPath:_pagesPath]]]
来更改页面。我不知道从哪里开始实现它,以便它会逐渐在页面之间滑动而不是即时。
哪里有教程吗?或者如果有人可以解释基本理论/使用哪个视图控制器等? 我将非常感激。
旁注: 我对 iOS 开发非常陌生(就像我几天前开始学习 Objective-C 一样)。我在 OO PHP 和客户端 Web 技术方面拥有非常深厚的背景。
我下载了一个非常好的 ePub 阅读器应用程序,并将其剥离并重新构建,以了解它的工作原理并更快地自学 Objective-C。到目前为止一切顺利,只需进行一些更改即可接受 PDF 并添加滑动手势。
问候, 基兰
I have a swipe gesture that changes the pages between ePub/PDF pages instantly. It uses a UIWebView to display the pages and [_webview loadRequest:[NSURLRequest requestWithURL:[NSURL fileURLWithPath:_pagesPath]]]
to change the page. I have no where to begin to implement it so that it will gradually swipe between pages instead of instant.
Are there any tutorials anywhere? Or if someone could explain the basic theory / which view controllers to use etc?
I'd be very grateful.
Side note:
I'm very new (as in I started learning obective-c a couple of days ago) to iOS development. I have a very strong background in OO PHP and client side web technologies.
I downloaded a pretty good ePub reader app and have stripped it down and rebuilt it to understand how it works and to teach myself objective-c quicker. So far so good, just made some changes so it'll accept PDFs as well and put in the swipe gestures.
Regards,
Kieran
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你真的不应该使用 UIWebView 进行渲染 - 它很慢而且不能真正定制。 Apple 在 iOS4 中引入了 QuickLook 作为更好的替代方案,但它也相当缓慢且静态。如果您需要快速的东西,您必须使用 Quartz 和 CGPDF* API 自己完成。
对于滑动手势,您需要的是启用分页的 UIScrollView,这比静态滑动要好得多,并且可以让您流畅地拖动页面。您可能还需要重用 UIScrollView 内的视图以获得更好的性能。
You really shouldn't use UIWebView for pf rendering - it's slow and not really customizable. Apple has introduced QuickLook in iOS4 as a better alternative, but it's also quite slow and static. If you need something fast, you hace to do it yourself, with Quartz and the CGPDF* API.
For the swipe gesture, what you want is a UIScrollView with paging enabled, that's much better than static sliding and lets you drag the pages fluidly. You also may need to reuse the views inside the UIScrollView for better performance.