Is it possible to tile images in a UIScrollView without having to manually create all the tiles?

前端 未结 5 1596
清歌不尽
清歌不尽 2020-12-23 18:20

In the iPhone sample code \"PhotoScroller\" from WWDC 2010, they show how to do a pretty good mimmic of the Photos app with scrolling, zooming, and paging of images. They al

5条回答
  •  别那么骄傲
    2020-12-23 18:39

    Sorry Jonah, but I think that you cannot do what you want to.

    I have been implementing a comic app using the same example as a reference and had the same doubt. Finally, I realized that, even if you could load the image and cut it into tiles the first time that you use it, you shouldn't. There are two reasons for that:

    1. You do the tiling to save time and be more responsive. Loading and tiling takes time for a large image.
    2. Previous reason is particularly important the first time the user runs the app.

    If these two reasons make no sense to you, and you still want to do it, I would use Quartz to create the tiles. CGImage function CGImageCreateWithImageInRect would be my starting point.

提交回复
热议问题