Search code examples
objective-cios5uiviewuiviewanimation

Slide from left (or right) animation transaction for UIView


I want to do a slide from left (or right) animation with my UIView like how it is done in Photos.app while you browse thorough photos by swiping left and right.

I know the following basic animation transaction code.

[UIView beginAnimations:@"ThisAnimation" context:nil];
[UIView setAnimationCurve:UIViewAnimationCurveEaseOut];
[UIView setAnimationDuration:1];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:self.view cache:YES];    

[UIView commitAnimations];

Is it possible to do slide from left (or right) animation using setAnimationTransaction? If not, how can I do it?


Solution

  • In addition to the other answer, you can find a cool tutorial here and there is a link to the project at the end of the tutorial so you can take a look at it.

    This is an automatic slideshow, but you can disable it by commenting the line where the NSTimer is defined. Also you should had the next line in the viewDidLoad for a better UX :

    scr.pagingEnabled = YES;
    

    Hope it helps