MkMapView setRegion animation prevents touch events on Annotation Views

We have a MKmapView with a bunch of Image Annotation where each Image annotation responds to touch by overriding these methods of AnnotationView subclass:

-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event; -(void) touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event

Our map region is updated using

[MkMapView setRegion:animated:]

whenever the new location is received and is far enough from the old location to make a difference.

What I noticed is that if we set animated flag to YES the touches on our annotation are rarely detected(probably due to the fact that main thread is busy animating between two map regions. When we set animated flag to NO, everything is fine, but map transition may(or may not) become jerky.

The question I have is whether this is an expected behavior of animated flag of [MkMapView setRegion:animated] function or whether there is a workaround for this issue.

Thanks in advance

Answers


Typically, the mapview being animated has its userInteractionEnabled property set to no during the animation. If you need to change this behavior, you should subclass the view and override the appropriate methods.

Alternatively, you could place a transparent view over the mapview for the duration of the animation to capture specific types of actions, such as respond to a double-tap to stop the change in region.


Need Your Help

popViewControllerAnimated animation is not working

objective-c ios5 uinavigationcontroller popviewcontrolleranimated

I know this is kind of repetitive question in SO, but I'm still unable to figure it out. The animation is not working when the app goes to background and then comes back up. The first time the app

How do I access an object response (rather than a list) in jqueryui autocomplete?

javascript jquery jquery-ui flask

I have a jqueryui autocomplete function I am trying to implement and the following returned results: