I downloaded the Xcode project from the link you provided and was able to reproduce the error. The following answer is a workaround that worked for me
MKMapView Do Not Call AreaDidChangeAnimated on Pan
For convenience, I want to repeat the solution and how I applied it in the mentioned project
In CustomCalloutViewController.h
add UIGestureRecognizerDelegate
@interface CustomCalloutViewController : UIViewController <MKMapViewDelegate, UIGestureRecognizerDelegate>
In CustomCalloutViewController.m
the method viewDidLoad
added before [super viewDidLoad];
if (NSFoundationVersionNumber >= 678.58){ UIPinchGestureRecognizer *pinch = [[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(pinchGestureCaptured:)]; pinch.delegate = self; [mapView addGestureRecognizer:pinch]; [pinch release]; UIPanGestureRecognizer *pan = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(panGestureCaptured:)]; pan.delegate = self; [mapView addGestureRecognizer:pan]; [pan release]; }
Then, still in CustomCalloutViewController.m
add the following
#pragma mark - #pragma mark Gesture Recognizers - (void)pinchGestureCaptured:(UIPinchGestureRecognizer*)gesture{ if(UIGestureRecognizerStateEnded == gesture.state){
Edit: I found another workaround here (all the bottom workarounds mentioned above). I have not tried it, but it sounds promising. I repeat it here:
My workaround is simple: in your view controller, create MKMapView in viewDidAppear :, and destroy it in viewDidDisappear :. I understand that this is not a friendly workaround for those using the Builder interface, but, in my opinion, this is the cleanest and probably the best way to save memory in your application.
source share