iOS Detect tap down and touch up of a UIView

前端 未结 5 2112
忘掉有多难
忘掉有多难 2020-12-01 05:06

I am stuck with a problem of determining how to detect a UIView being touched down and UIView being tapped. When it is touched down, I want the UIView to change its backgrou

5条回答
  •  忘掉有多难
    2020-12-01 05:49

    First off, by your selector handleDismissDoubleTap:, I'd assume you're looking for a double tap to dismiss. To achieve this, you should be doing: dismissGestureRecognition.numberOfTapsRequired = 2;

    Secondly, if by touch down you mean a prolonged tap (or a "tap and hold") kind of gesture, you should use a UILongPressGestureRecognizer instead of the UITapGestureRecognizer.

提交回复
热议问题