“分页”的最佳方式是什么? iOS 上有一个很长的 SVG 文件吗?

发布于 2024-12-03 21:12:31 字数 1502 浏览 3 评论 0原文

我在 SVG 和 iOS 方面遇到了一个有趣的问题。

我需要渲染很长的 SVG 文件(最多大约 5mb 大),这在使用 UIWebView 时不是问题。我也没有遇到过使用 JS 平滑滚动它们的问题,但由于我正在等待我的开发者计划申请获得批准,所以我还没有在实际设备上测试性能。

我现在正在尝试实现类似 iBooks 应用程序翻页的翻页效果。它不必那么复杂,这个想法的要点是 svg 的下一部分将“擦除”上一部分。

原因是,我需要内容的两个“页面”保持静态,以便在“翻转”过程中轻松阅读内容。快速滚动会使 SVG 的内容难以阅读。

这是我想要实现的目标的图形表示:

---------------------------
|                         |
|                         |
|                         |
|            1            |
|                         |
|                         |
|                         |
|                         |
---------------------------

---------------------------
|       |                 |
|       |                 |
|       |                 |
|   2   |         1       |
|       |->               |
|       |                 |
|       /                 |
|      /                  |
---------------------------

---------------------------
|                   |     |
|                   |     |
|                   |     |
|          2        |  1  |
|                   |->   |
|                   |     |
|                   /     |
|                  /      |
---------------------------

---------------------------
|                         |
|                         |
|                         |
|            2            |
|                         |
|                         |
|                         |
|                         |
---------------------------

期待你们退伍军人提出一些有趣的想法!

I am facing an interesting problem with SVG and iOS.

I need to render very long SVG files (up to about 5mb large), which hasn't been a problem using UIWebView. I also haven't had a problem scrolling them smoothly with JS, but since I'm waiting on my developer program application to be approved I haven't tested the performance on an actual device.

I'm now trying to achieve a page-turning effect like how the iBooks app flips pages. It doesn't have to be as elaborate and intricate, the gist of the idea is that the next section of the svg will "wipe over" the last.

Reason being, I need both "pages" of content to remain static to ease the reading of the content during the "flipping" process. Scrolling very quickly makes the contents of the SVG difficult to read.

Here is a graphic representation of what I would like to achieve:

---------------------------
|                         |
|                         |
|                         |
|            1            |
|                         |
|                         |
|                         |
|                         |
---------------------------

---------------------------
|       |                 |
|       |                 |
|       |                 |
|   2   |         1       |
|       |->               |
|       |                 |
|       /                 |
|      /                  |
---------------------------

---------------------------
|                   |     |
|                   |     |
|                   |     |
|          2        |  1  |
|                   |->   |
|                   |     |
|                   /     |
|                  /      |
---------------------------

---------------------------
|                         |
|                         |
|                         |
|            2            |
|                         |
|                         |
|                         |
|                         |
---------------------------

Looking forward to some interesting ideas from you veterans!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

神经暖 2024-12-10 21:12:31

我并没有满足这样的需求,但据我所知,它可以由两个 UIView (或其任何子类)来实现。您所要做的就是自定义翻转动画(如果您只对翻转感兴趣,则可以使用简单的动画;如果您需要动画实际用手指进行翻转,则可以使用较难的动画)。当然,您需要将文件的相应部分放入这些视图中。实际上,我建议使用 3 个视图,这样您就可以将下一个“页面”的内容放在屏幕外。这将使你的动画更加流畅。

I haven't rut to such needs, but from what I know, it could be made by two UIViews (or any of their subclasses). All you have to do is a custom animation on flip(a simple one if you interested in flip only, a harder one if you need the animation actually to go one with the finger). And of course you'll need to put corresponding part of your file to those views. Actually I would suggest using 3 views, so you'll be able to put content of the next "page" while it still offscreen. That will make your animation smoother.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文