Detecting Pan Gesture End

后端 未结 5 660
萌比男神i
萌比男神i 2020-12-29 01:05

I\'ve got a view and I applied a UIPanGestureRecogniser to this view:

UIPanGestureRecognizer *panGesture = [[UIPanGestureRecognizer alloc] initWithTarget:sel         


        
5条回答
  •  长情又很酷
    2020-12-29 01:31

    Pan gesture end event can be detected by checking the it's state with UIGestureRecognizerStateEnded or UIGestureRecognizerStateCancelled or UIGestureRecognizerStateFailed

    Check with the below code .

       -(void) panGesture:(UIPanGestureRecognizer*) gestureRecognizer
        {
         if(gestureRecognizer.state == UIGestureRecognizerStateEnded || gestureRecognizer.state == UIGestureRecognizerStateFailed || gestureRecognizer.state == UIGestureRecognizerStateCancelled)
                 {
                    //code what you want.
                 }
         }
    

提交回复
热议问题