I create a view controller and i put a UIImageView in it, I made an NSArray that contains the images and I passed this NSarray in the UIImageView, and I added a UISwipeGestureRecognizer for left an right swiping.
This code works but the images come when swiping like boom without effects or transition, is there a way to add a simple transition between them?
Here is the code:
Thanks in Advance
This code works but the images come when swiping like boom without effects or transition, is there a way to add a simple transition between them?
Here is the code:
Code:
NSArray *images = [[NSArray alloc] initWithObjects:
@"1-r.png",
@"2-r.png",
@"3-r.png",
@"4-r.png",
@"5-r.png",
nil];
UISwipeGestureRecognizerDirection direction = [(UISwipeGestureRecognizer *)sender direction];
switch (direction) {
case UISwipeGestureRecognizerDirectionLeft:
imageIndex++;
break;
case UISwipeGestureRecognizerDirectionRight:
imageIndex--;
break;
default:
break;
}
imageIndex = (imageIndex < 0) ? ([images count] - 1) : imageIndex % [images count];
_imageView.image = [UIImage imageNamed:[images objectAtIndex:imageIndex]];
Thanks in Advance
Last edited by a moderator: