How do I make the swipe to kill animation that is used in the iOS 7 app switcher?

好久不见. 提交于 2019-12-04 20:24:57

There are several parts here.

  1. Point of release. It can be "over the line", when view will be removed or "under", when it will return to the starting position.
  2. Speed during the release. If the speed is high, then "view does have enough energy to go over the line".

So, if the point is "high enough" or the speed is "high enough", we will remove the view, or will return it back otherwise.

Third thing is removal/returning animation. It does need to have inertia to behave more physically correct. You can make simple thing. Let the duration to the "remove window" animation depend on 1/speed. So faster you go, faster the animation will be.

Return animation is a little bit trickier. Window has to go a little bit up and then down. It's where UIKit Dynamics can come handy.

I did all the things except "return animation" for my project and it looks very nice.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!