我已经开始为iOS编程几周了,所以我不知道之前是怎么做的,但是我想为我的segues使用其他过渡样式。就像屏幕翻转的那样,给你的印象是目标视图控制器位于第一个控制器的背面。我想我必须继承UIStoryboardSegue,但除此之外,我不知道从那里去哪里。
谢谢你的时间!
答案 0 :(得分:1)
您可以在自定义Segue中使用CATransition来实现任何类型的转换。这是示例代码。
-(void)perform {
__block UIViewController *sourceViewController = (UIViewController*)[self sourceViewController];
__block 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];
}
您可以访问此链接了解更多详情http://blog.jambura.com/2012/07/05/custom-segue-animation-left-to-right-using-catransition/
答案 1 :(得分:0)
好的我看起来不够远。选择要自定义的segue,并且有一个“过渡”样式选项。