在 UIWebView 上实现 CATiledLayer 以实现快速滚动
我的 iPad 应用程序中有一个很大的 Web 视图,滚动性能似乎是一个大问题,尤其是第一次浏览 Web 视图时。在移动版 Safari 中,滚动非常流畅,页面仅显示为透明棋盘图案,并在进入视图时加载。根据我的阅读,处理这个问题的方法是使用 CATiledLayer,但我不知道如何实现它。有人能指出我正确的方向吗?谢谢!
I have a big webview in my iPad app and scrolling performance seems to be a big issue, especially the first time you browse the webview. In mobile Safari, the scrolling is extremely smooth and the page simply appears as a transparent checkerboard pattern and loads in as it comes into view. From what I've read, the way to handle this is using CATiledLayer, but I have no idea how to implement this. Can anyone point me in the right direction? Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
UIWebView 应该已经在幕后完成了自己的平铺工作。据我所知,由于 UIWebView 的渲染架构复杂,无法手动支持带有 CATiledLayer 的 UIWebView。
如果您创建的 UIWebView 仅是显示屏的大小,我能想到的滚动速度比 Mobile Safari 慢的唯一原因是滚动时需要在 Web 视图上合成其他覆盖视图。
A UIWebView should already do its own tiling behind the scenes. There's no way to manually back a UIWebView with a CATiledLayer that I'm aware of, due to its complex rendering architecture.
If you create a UIWebView that is only the size of the display, the only reason I could think of for slower scrolling than Mobile Safari would be other overlaid views that need to be composited on the web view when scrolling.