How to know which image is being viewed in UIScrollView? Also, is it possible to loop scrolling for
Posted
by bruin
on Stack Overflow
See other posts from Stack Overflow
or by bruin
Published on 2010-03-19T05:33:16Z
Indexed on
2010/03/19
5:41 UTC
Read the original article
Hit count: 238
This is what I'm trying to do, and I'm not sure if it's possible using UIScrollView. First, I don't care about zooming, all I care is that the user is able to scroll through images just like the Photo App, this I got. But how do I know which image he is viewing while using UIScrollView? For instance, if he stops on the 3rd image out of 10 images in the view, how do I know he's on that image? I can't find a way to access the index (is this accessible)??
Also, bonus question, once the user scrolls to the last image, I don't want the scrolling to stop but I want it to loop so that image 1 comes after image 10. And vice versa, if you scroll left passed image 1, you'll see image 10. I'm not asking for the logic, I can do this in an array very simply, I just don't know how to access (if it's even possible) the indexing of the images in the scroll view.
If it's not, does anyone have a solution to do this?
thanks in advance!
© Stack Overflow or respective owner