开发者

What is the best way to "paginate" a loooong SVG file on iOS?

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            |
|                         |
|                         |
|                         |
|                         |
---------------------------

---------------------------
|       |              开发者_如何学Go   |
|       |                 |
|       |                 |
|   2   |         1       |
|       |->               |
|       |                 |
|       /                 |
|      /                  |
---------------------------

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

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

Looking forward to some interesting ideas from you veterans!



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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜