更新时间:2023-12-05 15:14:16
实际上可以使用 UIPreviewInteraction API 来完成。
This actually might be done using UIPreviewInteraction API.
https://developer.apple.com/documentation/uikit/uipreviewinteraction
它几乎类似于 Peek和Pop API 。
这里有两个阶段:预览和提交,分别对应Peek和Pop在后来的API中。我们有 UIPreviewInteractionDelegate ,它让我们可以访问这些阶段的过渡。
Here we have 2 phases: Preview and Commit which are corresponding to the Peek and Pop in the later API. we have UIPreviewInteractionDelegate which gives us the access to the transition through these phases.
那么应该做的是复制上面的Apple Music Popup,
So what one should do is, to replicate the above Apple Music Popup,
构建上述菜单的xib并在 didUpdateCommitTransition 期间显示它/ p>
Build an xib of the above menu and show it during didUpdateCommitTransition
实际上,apple已经以聊天应用程序的形式构建了一个这样的演示。
Actually, apple has built a demo of this in the form of a Chat App.
从这里并测试它。