Possible Duplicate:
iPhone Image slideshow
I want to do a simple slideshow with 6 images but i have any idea on how to do that. It's with UIPageControl ? there are a tutorial ?
Possible Duplicate:
iPhone Image slideshow
I want to do a simple slideshow with 6 images but i have any idea on how to do that. It's with UIPageControl ? there are a tutorial ?
If its UIPageViewController, in your root view controller, call the method
- (void)setViewControllers:(NSArray *)viewControllers direction:(UIPageViewControllerNavigationDirection)direction animated:(BOOL)animated completion:(void (^)(BOOL finished))completion
Call this method in a timer.
It depends on the way you want to show the images. There are ways to acheive this result, NSTimer,UIPageControl with ScrollView(image Change towards right hand side direction) ,ImageView.animationImages method(change is instant with no animation).
You can use a UIScrollViewController. So, when you have, for example, an array of image names, you can do something like
for(NSString *imageName in imageNames){
UIImageView *image = [[UIImageView alloc] initWithImage:[UIImage imageNamed:imageName]];
image.frame = CGRectMake([imageNames indexOf:imageName] * SCREENWIDTH, 0, SCREENWIDTH, SCREENHEIGHT);
[scrollView addSubview:image];
[image release];
}
Be sure to select the Paging Enabled option for the scrollView in Interface Builder. Now you can do a slideshow with your fingers. If you want it to be automatic you can also use
[self performSelector:@selector(slide) withObject:nil afterDelay:1];
And in another function
-(void)slide{
[scrollView setContentOffset:CGPointMake(/*calculate X axis offset*/,0) animated:YES]
}