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
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
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.