Curtis Boylan Curtis Boylan - 8 months ago 74
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");

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

    if(panGesture.state == UIGestureRecognizerStateEnded){
        //do whatever