Curtis Boylan Curtis Boylan - 2 years ago 137
Objective-C Question

iOS Pan Gestures

I am trying to instead of making my pan gesture spam the function when it pans, that it only plays the function once when the panning is finished, I have looked all online and fail to find a way to do this. Anyone got any solutions?

Current code below:

UIPanGestureRecognizer *panRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget: self action:@selector(didPan:)];
self.mapView.gestureRecognizers = @[panRecognizer];

- (void) didPan:(UIPanGestureRecognizer*) gestureRecognizer
NSLog(@"DID PAN");

Answer Source
- (void)panGestureDetected:(UIPanGestureRecognizer*)panGesture {

    if(panGesture.state == UIGestureRecognizerStateEnded){
        //do whatever
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download