0

如何使用 CATransition 从一个控制器移动到下一个控制器,以便视图向上移动以显示第二个窗口。我希望控制器 1 的视图向上移动并显示第二个控制器的视图。我怎样才能做到这一点?

这就是我在做什么?

CATransition *transition = [CATransition animation];
transition.duration = 0.7f;
transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear];
transition.type = kCATransitionFromBottom;

[self.navigationController.view.layer addAnimation:transition forKey:nil];

[self.navigationController pushViewController:destinationController animated: NO];
4

1 回答 1

0

试试这个

CATransition* transition = [CATransition animation];
transition.duration = 0.7f;
transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
transition.type = kCATransitionFade; //kCATransitionMoveIn,kCATransitionReveal, kCATransitionFade, kCATransitionPush, 
//transition.subtype = kCATransitionFromTop; //kCATransitionFromRight, kCATransitionFromTop, kCATransitionFromLeft, kCATransitionFromBottom
[self.navigationController.view.layer addAnimation:transition forKey:nil];
[[self navigationController] popViewControllerAnimated:NO];
于 2012-12-14T12:09:14.103 回答