filtering single and double taps

前端 未结 4 1625
伪装坚强ぢ
伪装坚强ぢ 2020-12-09 03:59

When the user single taps my view, i need one specific method to run. When the user double taps, i need another method do take place.

The problem is that the double

4条回答
  •  孤街浪徒
    2020-12-09 04:54

    Swift Solution :

        doubleTapSmall1.numberOfTapsRequired = 2
        doubleTapSmall1.addTarget(self, action: "doubleTapPic1")
        smallProfilePic1.addGestureRecognizer(doubleTapSmall1)
    
        singleTapSmall1.numberOfTapsRequired = 1
        singleTapSmall1.addTarget(self, action: "singleTapPic1")
        singleTapSmall1.requireGestureRecognizerToFail(doubleTapSmall1)
        smallProfilePic1.addGestureRecognizer(singleTapSmall1)
    

提交回复
热议问题