如何在iPhone上创建一个像通知面板一样的可拖动面板
我正在尝试创建一个可拖动面板/视图(在iPhone上),您可以从下到上打开它,例如ios5的通知面板,我认为是扫描和可拖动之间的混合,但我不知道。
预先感谢您的帮助!
i'm trying to create a draggable panel/view (on iphone) that you can open bottom to top something like the notifications panel of ios5, i think is a mix between sweep and draggable but i dont know.
Thanks in advance for your assistance!
您可以将 UISwipeGestureRecognizer 与向下方向,并检查它是否开始足够靠近顶部,然后将视图从可见区域上方动画化到可见区域。
或者,如果您希望能够从顶部拖动它,您可以使用 UIPanGestureRecognizer,再次检查它是否开始足够靠近顶部。使用获取平移平移
,然后将视图平移相同的量。
You could use a UISwipeGestureRecognizer with down direction, and check that it starts close enough to the top, then animate a view from above the visible area to the visible area.
Or if you want to be able to drag it from the top you could use a UIPanGestureRecognizer, again checking that it starts close enough to the top. Get the panning translation using
then translate the view by the same amount.