重新创建 Instagram 长按一瞥? [英] Recreating Instagram longpress peek?

查看:39
本文介绍了重新创建 Instagram 长按一瞥?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望重新创建此视频中显示的图片功能:

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.

这只是我需要学习的 scrollView 代码吗?例如,我想有一种方法可以检测滚动条何时滚动到足够远以触发呈现选项视图.是什么让视图在向上拖动和释放后弹回原位?等

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?

推荐答案

如果我没记错的话,这就是Apple 的"3D touch API 魔法✨查看他们的文档

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

您可能对以下内容感兴趣:

You might be interested in :

ViewControllerPreviews:使用 UIViewController 预览 API,演示 peek(预览)和 pop(提交),以及 peek 快速操作

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

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

这篇关于重新创建 Instagram 长按一瞥?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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