简体   繁体   English

想要模仿iPhone锁屏相机拖动

[英]Looking to mimic the iPhone lock screen camera drag

I've been searching and searching on how apple makes the dragging motion on the lock screen to open the camera so clean. 我一直在寻找苹果如何使锁定屏幕上的拖动动作如此干净地打开相机。 I'm trying to do a similar thing with an app where you drag from the bottom up to reveal a menu, but i cant quite get it right. 我正在尝试使用一个应用程序做类似的事情,在该应用程序中您从下往上拖动以显示菜单,但我无法完全正确。 Anyone know how to, or of any tutorials that show how to do this? 有谁知道如何做,或者有任何显示如何做的教程? Thanks in advance! 提前致谢!

To follow up what's been mentioned by Hejazi I believe you can achieve this in 3 steps: 要跟进Hejazi提到的内容,我相信您可以通过3个步骤来实现:

  • create a background rectangle with some corner radius (this is a property of CGRect). 创建一个具有一定角半径的背景矩形(这是CGRect的属性)。
  • create a top view, corresponding to the part you want to be able to slide. 创建一个与要滑动的零件相对应的顶视图。 Attach a pan gesture to this view so you will be able to handle the animation for this view. 将平移手势附加到该视图,以便您可以处理该视图的动画。
  • for the text part being highlighted I think you need another two views: I will apply a mask corresponding to the text to a view so you get some transparency only for the letters of your text and animate a white round view behind it. 对于突出显示的文本部分,我认为您还需要另外两种视图:我将在视图上应用与文本相对应的蒙版,以便仅对文本字母具有一定的透明度,并为其后的白色圆形视图设置动画。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM