tags:

views:

820

answers:

1

I have a UIScrollView which houses several views. When a user flick using a finger, the view scrolls to right or left depending on direction of finger flick. Basically code works in a way similar to iphone's photo app works. Now is there a way I can programmatically do what user's finger does so that I end up with sort of a slideshow that runs on its own with a click of some button and, say with configurable pause between each scroll ?

How do you really do slideshows with UISscrollView ?

+2  A: 

You can scroll to some point in a scroll view with

[scrollView setContentOffset:CGPointMake(x, y) animated:YES];

To do slideshows with UIScrollView, you arrange all images in the scroll view, set up a repeated timer, then -setContentOffset:animated: when the timer fires.

But a more efficient approach is to use 2 image views and swap them using transitions or simply switching places when the timer fires. See http://stackoverflow.com/questions/1631170/iphone-image-slideshow for details.

KennyTM
Cool. Yes, I did find that setContentOffset works but really wanted this to happen in animated way. 'animated:YES' did the trick.
climbon