Recreating Instagram longpress peek?

邮差的信 提交于 2020-01-14 02:58:11

问题


I'm looking to recreate the functionality that's show in this video for the picture:

https://www.youtube.com/watch?v=zEREoIcoQHE

A long press is done, a view appears, and when the user swipes up far enough, the options come up at the bottom. If the user continues to drag up higher and then lets go, the main view animates to bounce back down to the middle of the screen. If the user swipes all the way down, the view animates away.

I recognize there is a lot going on here and a lot of different pieces and that this is a very broad question. I'm more or less looking for a place to get started with it. The only thing I really recognize here is I guess a scrollview. I know how to do all of the basic stuff with presenting and dismissing the different views, but the dragging and the scrolling and the snapping back into place is where I'm not sure where to begin.

Is that all just scrollView code I need to learn? For example I guess there's a way to detect when the scroll has been scrolled far enough up to trigger presenting the options view. What is making the view bounce back into place after dragging up and releasing? etc.

What tools are used to achieve this kind of behavior?


回答1:


If I am not mistaken thats the "Apple's" 3D touch APIs magic ✨ Check out their documentation

You might be interested in :

ViewControllerPreviews: Using the UIViewController previewing APIs, which demonstrates peek (preview) and pop (commit), as well as peek quick actions

Reference: https://developer.apple.com/library/content/samplecode/ViewControllerPreviews/Introduction/Intro.html#//apple_ref/doc/uid/TP40016546



来源:https://stackoverflow.com/questions/42049135/recreating-instagram-longpress-peek

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