当前位置: 动力学知识库 > 问答 > 编程问答 >

ios - CATransition scroll animation

问题描述:

I'm using CATransition animation to segue between my views with swype gesture. Is there any way to make this animation looks like scroll/paging between my views?

Here's my code:

-(void)perform {

UIViewController *sourceViewController = (UIViewController*)[self sourceViewController];

UIViewController *destinationController = (UIViewController*)[self destinationViewController];

CATransition* transition = [CATransition animation];

transition.duration = 0.2;

transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];

transition.type = kCATransitionPush; //kCATransitionMoveIn; //, kCATransitionPush, kCATransitionReveal, kCATransitionFade

transition.subtype = kCATransitionFromRight; //kCATransitionFromLeft, kCATransitionFromRight, kCATransitionFromTop, kCATransitionFromBottom

[sourceViewController.navigationController.view.layer addAnimation:transition forKey:kCATransition];

[sourceViewController.navigationController pushViewController:destinationController animated:NO];

}

分享给朋友:
您可能感兴趣的文章:
随机阅读: