如何使用segues执行自定义动画?

时间:2023-01-23 15:04:04

In Storyboards, you can customize the transition by clicking on the segue (the circle symbol between the two screens) and set the Transition to "Cover Vertical", "Flip Horizontal", "Cross Dissolve" or "Partial Curl" (you can uncheck "Animate" if you don’t want any animation at all).

在Storyboard中,您可以通过单击segue(两个屏幕之间的圆圈符号)自定义过渡,并将过渡设置为“Cover Vertical”,“Flip Horizo​​ntal”,“Cross Dissolve”或“Partial Curl”(您可以取消选中)如果您根本不想要任何动画,请“动画”。

If I use a Storyboard, is it possible to customize this transition by code?

如果我使用Storyboard,是否可以通过代码自定义此转换?

1 个解决方案

#1


7  

Ok, I finally found all the answers here: http://www.appcoda.com/custom-segue-animations/

好的,我终于找到了所有答案:http://www.appcoda.com/custom-segue-animations/

Creating a custom segue is not difficult at all, as it consists of a standard programming technique in iOS. What is actually only required, is to subclass the UIStoryboardSegue class and override just one method, named perform. In this method the custom animation logic must be implemented. Triggering the transition from a view controller to another and back must also be programmatically performed by the developers, but this is a totally standard procedure.

创建自定义segue并不困难,因为它包含iOS中的标准编程技术。实际上只需要的是,继承UIStoryboardSegue类并仅覆盖一个名为perform的方法。在此方法中,必须实现自定义动画逻辑。触发从视图控制器到另一个视图控制器的转换也必须由开发人员以编程方式执行,但这是一个完全标准的过程。

#1


7  

Ok, I finally found all the answers here: http://www.appcoda.com/custom-segue-animations/

好的,我终于找到了所有答案:http://www.appcoda.com/custom-segue-animations/

Creating a custom segue is not difficult at all, as it consists of a standard programming technique in iOS. What is actually only required, is to subclass the UIStoryboardSegue class and override just one method, named perform. In this method the custom animation logic must be implemented. Triggering the transition from a view controller to another and back must also be programmatically performed by the developers, but this is a totally standard procedure.

创建自定义segue并不困难,因为它包含iOS中的标准编程技术。实际上只需要的是,继承UIStoryboardSegue类并仅覆盖一个名为perform的方法。在此方法中,必须实现自定义动画逻辑。触发从视图控制器到另一个视图控制器的转换也必须由开发人员以编程方式执行,但这是一个完全标准的过程。