navigationController:pushViewController,具有iPhone事务的特殊效果

时间:2013-03-06 15:06:58

标签: iphone objective-c uinavigationcontroller pushviewcontroller

通常我们总是使用以下方法从一个视图推送到另一个视图:

[self.navigationController pushViewController:nextView animated:YES];

for some other animations we used :UIViewAnimationTransitionCurlDown / flipRight etc etc.

所有这些都经常使用,

我希望我的应用程序具有不同的过渡 ..

过渡中的任何其他自定义过渡/特效...(推/弹出)或动画的任何其他外部API ..

1 个答案:

答案 0 :(得分:7)

您可以使用 CATransition

CATransition *transition = [CATransition animation];
transition.duration = 1.0;
transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
transition.type = kCATransitionPush;
transition.subtype = kCATransitionFromTop;
transition.delegate = self;
[self.navigationController.view.layer addAnimation:transition forKey:nil];

[self.navigationController pushViewController:nextView animated:YES];

您可以按以下方式更改转换:transition.subtype = kCATransitionFromTop;

不要忘记添加Quartzcore框架!

相关问题