MKMapView regionDidChangeAnimated not always called!

后端 未结 5 1757
北荒
北荒 2021-01-17 14:31

This is frustrating me!!!

It will be called most of the time but then it stops responding to the pinches. It will be called on a screen rotate and a double tap. No

5条回答
  •  爱一瞬间的悲伤
    2021-01-17 15:17

    I managed to solve this problem by disabling the gesture recognizer within the touchesBeganCallback

    self.tapInterceptor.touchesBeganCallback = ^(NSSet *touches, UIEvent *event) {
        self.tapInterceptor.enabled = NO;
        // do something
    };
    

    and reenabling it in the regionDidChangeAnimated delegate method

    - (void)mapView:(MKMapView *)mapView regionDidChangeAnimated:(BOOL)animated {
        self.tapInterceptor.enabled = YES;
        // do something
    }
    

提交回复
热议问题