开发者

Touch to move through images

I have an NSMutableArray of jpg images and I want to be able to touch and, moving my finger from right to left, move through the array of images in order. I've been reading about UIScrollView, but I'm not sure if this accomplishes what I am looking for. It seems to me that UIScrollVi开发者_如何学Cew is more used for viewing an object that is too large to be displayed entirely on the screen and you need to be able to move to see every part of the object. I need to move to an entirely new image, the next image in my array. What is the best way to go about this?


You certainly can use a UIScrollView for what you want. A scroll view can be used, as you noted, to scroll an area that is too large for the screen. However, you can also use it to scroll through "pages". This is really the best way to do what you want, short of rolling your won scroll view.

There is a property of UIScrollView, called pagingEnabled, which you'll want to set to YES. I suggest that you give it a try. Also, have a look at the UIScrollView documentation and the Scroll View programming guide. It will tell you all that you need to know about UIScrollViews. Also, remember that for proper memory management, you'll want to only load three images at any given time. See this answer that I wrote for more information on that, and on UIScrollViews in general.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜