i have a scrolview with paging it’s a scrol view for slide with 4 picture it’s work fine with user interaction so my question i want to set this scrolview scrol automatique without user interaction so like a banner for pub this is my code in view didload :
[UIScrollView beginAnimations:nil context:nil];
[UIScrollView setAnimationDuration:4.0];
[UIScrollView setAnimationDelay:4.0];
[scroller setContentOffset:CGPointMake(320, 98)];
[UIScrollView commitAnimations ];
in this whay the scrol automatic work but the probleme the scrol wait 4 s and after go to the seconde image and is stop and if i add this code
[UIScrollView beginAnimations:nil context:nil];
[UIScrollView setAnimationDuration:4.0];
[UIScrollView setAnimationRepeatAutoreverses:YES];
[UIScrollView setAnimationRepeatCount:INFINITY];
[UIScrollView setAnimationDelay:4.0];
[scroller setContentOffset:CGPointMake(320, 98)];
[UIScrollView commitAnimations ];
the scroller don’t stop 4s after showing the second picture so in this case it’s stop at first 4s after if the annimation begin don’t stop never
so my question i want to do this :
image 1 —showing fo 4 s —–image2 —-showing for 4s —– image3 —-showing for 4s —-image 4 —-showing for 4 s —– image 1 —- showing for 4 s …… like this automatique
so if someone can help me with example code or tutorial or any documentation it’s will be very cool because i search in google and i find anything
I’ve made an example in an earlier answer of mine:
UITableView scroll smooth with certain speed?
This example will be quite relevant for you if you can decypher the changes you need to make.
The following is what you need to do:
At the moment you want to start the animation (which is prolly at the start or selection on the page even) you need to start the timer. Then at a certain custom interval you can fire a method that sets the contentOffset a little further to the right (change Y-value appropriately). When you came at the end of the pages or when you ran the target method x-times (which is ezily stored in a property/global val) you can invalidate the timer.
Look at the question I posted and you will find every piece of the puzzle there.
You will figure it out.
Good luck.