In iOS, how to drag down to dismiss a modal?

后端 未结 15 2346
粉色の甜心
粉色の甜心 2020-11-28 00:41

A common way to dismiss a modal is to swipe down - How do we allows the user to drag the modal down, if it\'s far enough, the modal\'s dismissed, otherwise it animates back

15条回答
  •  粉色の甜心
    2020-11-28 01:05

    You can use a UIPanGestureRecognizer to detect the user's drag and move the modal view with it. If the ending position is far enough down, the view can be dismissed, or otherwise animated back to its original position.

    Check out this answer for more information on how to implement something like this.

提交回复
热议问题