I am trying a simple project (storyboard) where the user swipes from right to left to get to the next view and so on and to go back the user swipes from left to right. I want to achieve the transition to follow the swipe (L-->R or R-->L).
I have found this:
-(void)perform {
UIViewController *sourceViewController = (UIViewController*)[self sourceViewController];
UIViewController *destinationController = (UIViewController*)[self destinationViewController];
CATransition* transition = [CATransition animation];
transition.duration = .25;
transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
transition.type = kCATransitionPush; //kCATransitionMoveIn; //, kCATransitionPush, kCATransitionReveal, kCATransitionFade
transition.subtype = kCATransitionFromLeft; //kCATransitionFromLeft, kCATransitionFromRight, kCATransitionFromTop, kCATransitionFromBottom
[sourceViewController.navigationController.view.layer addAnimation:transition
forKey:kCATransition];
[sourceViewController.navigationController pushViewController:destinationController animated:NO];
}
but this doesn't seem to be doing what is supposed to do.
EXPLAIN:
when i m in landscape (my project only works in landscape) and home button is on the left, the animation comes from the TOP!!! When I m in landscape and home button is on the right the animation comes from the BOTTOM!!!
Although I have specified it to be from the left. The other thing is that it changes direction when i use diferent landscapes (homebutton on the left or right).
Any ideas why is this happening???