过渡期间的动画共享两个viewControllers之间的图像 [英] Sharing an Image between two viewControllers during a transition animation

查看:166
本文介绍了过渡期间的动画共享两个viewControllers之间的图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经跨越很酷的过渡viewControllers之间就因为UIViewControllerAnimatedTransitioning协议是在IOS 7提供最近我注意到Intacart的IOS应用程序特别有意思。

I have came across really cool transitions between viewControllers since UIViewControllerAnimatedTransitioning protocol was made available in IOS 7. Recently I noticed a particularly interesting one in Intacart's IOS app.

下面是我讲的慢动作动画:
https://www.dropbox.com/s/p2hxj45ycq18i3l/Video%20Oct%2015%2C%207%2023%2059%20PM.mov?dl=0

Here is the animation I am talking about in slow motion: https://www.dropbox.com/s/p2hxj45ycq18i3l/Video%20Oct%2015%2C%207%2023%2059%20PM.mov?dl=0

首先,我认为这是类似于笔者在本教程中走过时,与一些额外的淡入和淡出的动画:<一href=\"http://www.raywenderlich.com/113845/ios-animation-tutorial-custom-view-controller-$p$psentation-transitions\" rel=\"nofollow\">http://www.raywenderlich.com/113845/ios-animation-tutorial-custom-view-controller-$p$psentation-transitions

First I thought it was similar to what the author walks through in this tutorial, with some extra fade-in and fade-out animations: http://www.raywenderlich.com/113845/ios-animation-tutorial-custom-view-controller-presentation-transitions

不过,如果你仔细看看它,它看起来像两个viewControllers之间的产品形象转变为第一的viewController淡出。为什么我认为有两个viewControllers的原因是因为当你刷卡新的视图下来,你仍然可以看到它背后的原始视图没有布局的变化。

But then if you look at it closely, it seems like the product image transitions between the two viewControllers as the first viewController fades out. The reason why I think there are two viewControllers is because when you swipe the new view down, you can still see the original view behind it with no layout changes.

也许两个viewControllers居然有产品形象(未淡出),并同时具有完善的precision在某种程度上动画,其中一个淡入与其他淡出。

Maybe two viewControllers actually have the product image (not faded out) and are somehow animating at the same time with perfect precision and one of them fades in as the other fades out.

你认为究竟是怎么回事呢?

What do you think is actually going on there?

这怎么可能这样的过渡动画,它看起来像一个镜像是在两个viewControllers之间共享的程序?

How is it possible to program such a transition animation that it looks like an image is shared between two viewControllers?

推荐答案

这可能是两种不同的观点和动画快照视图。事实上,这也正是为什么快照视图被发明了。

It's probably two different views and an animated snapshot view. In fact, this is exactly why snapshot views were invented.

这就是我怎么做我的应用程序。观看红色矩形为presented观的运动上下滑动:

That's how I do it in my app. Watch the movement of the red rectangle as the presented view slides up and down:

在这里输入的形象描述

它看起来像红色的视图离开第一视图控制器,并进入第二视图控制器,但它只是一种错觉。如果你有一个自定义的过渡动画,可以在转换过程中添加额外的意见。所以我创建看起来就像第一个视图快照视图,隐藏真实第一个视图,并移动快照视图 - 然后删除快照视图,并显示出真实的第二种观点

It looks like the red view is leaving the first view controller and entering the second view controller, but it's just an illusion. If you have a custom transition animation, you can add extra views during the transition. So I create a snapshot view that looks just like the first view, hide the real first view, and move the snapshot view — and then remove the snapshot view and show the real second view.

在这里同样的事情(比如,我用它在许多应用程序的一个好招):它看起来像标题已经从第一视图控制器表视图细胞松动和滑动到进入第二视图控制器,但它的只是一个快照视图:

Same thing here (such a good trick that I use it in a lot of apps): it looks like the title has come loose from the first view controller table view cell and slid up to into the second view controller, but it's just a snapshot view:

在这里输入的形象描述

这篇关于过渡期间的动画共享两个viewControllers之间的图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆