简体   繁体   English

如何使用动画在控制器之间滑动?

[英]How to make swipe between Controllers with animation?

I have my structure like 我的结构像

Controller 1 <-> Controller 2 <-> Controller 3 <-> ...<->Controller N 控制器1 <->控制器2 <->控制器3 <-> ... <->控制器N

I need to be able to access to controller 1 or 3 directly from another controllers. 我需要能够直接从另一个控制器访问控制器1或3。 I need swipe animation between controllers 1-n , and navigation bar with < and > buttons. 我需要在控制器1-n和带有<和>按钮的导航栏之间滑动动画。

What is the best solution for this swiping controllers? 这种刷卡控制器的最佳解决方案是什么? I need be able to do some animation there. 我需要在那里做一些动画。 Do i need use paged UIScrollView ? 我需要使用分页的UIScrollView吗? or UIPageViewController ? 还是UIPageViewController With animation - CALayer transition? 带有动画CALayer过渡吗? Please, help me to choose. 请帮我选择。

Hello @Alexander and anyone else who needs a solution to this problem, I think the easiest way to deal with this situation would be to use the UIGestures which will give great animations and will simply be justified using the storyboard. 您好@Alexander以及需要解决此问题的其他任何人,我认为处理这种情况的最简单方法是使用UIGestures,该UIGestures可以提供出色的动画效果,并且只需使用情节提要即可。 To use it from one view controller to the other, just do the following: 要从一个视图控制器到另一个视图控制器使用它,只需执行以下操作:

If your side view is open, this will show up on the bottom right side of the storyboard: 如果您的侧视图是打开的,它将显示在情节提要的右下角: 在此处输入图片说明

Then, you will have to drag the swipe gesture recognizer to the initial view controller and then let go when the whole view is highlighted in blue: 然后,您必须将滑动手势识别器拖动到初始视图控制器,然后在整个视图以蓝色突出显示时放开:

在此处输入图片说明

After that, you will have to control-drag the gesture icon on the top of the initial view controller to the controller you want to connect to. 之后,您必须控制将初始视图控制器顶部的手势图标拖动到要连接的控制器上。 Then it will show a drop down list after you let go of the highlighted controller. 放开突出显示的控制器后,它将显示一个下拉列表。 Pick any segue: 选择任何segue:

在此处输入图片说明

You can do this with all the view controllers by creating more gestures and segues. 您可以通过创建更多的手势和标记来使用所有视图控制器来执行此操作。 You can also do it from the same view controller back or even skip controllers with different types of gesture recognizers. 您也可以从同一个视图控制器返回,甚至跳过具有不同类型手势识别器的控制器。

I hoped it helped :) 我希望它可以帮助:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM