MKMapViewDelegate: need API to differentiate region changes initiated via a user gesture

Originator:futuretap
Number:rdar://16867174 Date Originated:09-May-2014 06:02 PM
Status:Open Resolved:
Product:iOS SDK Product Version:7.1
Classification:Feature (New) Reproducible:Not Applicable
 
The current mapView:regionWillChangeAnimated: delegate callback doesn't tell whether the region change is caused by a user gesture or by a programmatic region change. 

I'm proposing another delegate method:

- (void)mapView:(MKMapView *)mapView regionWillChangeAnimated:(BOOL)animated initiatedByUser:(BOOL)initiatedByUser

It would behave similarly to the current delegate callback. The initiatedByUser flag would be set if and only if the user panned, pinched, double or 2-finger-tapped the mapView or if the user selected a pin near the border forcing the mapView to scroll before displaying the callout.

This would be helpful to break feedback loops for apps that fetch content depending on the current map region and zoom to the fetched annotations at the same time. Currently there is a feedback loop:

1. fetch new content =>
2. zoom to fetched annotations =>
3. map region update detected =>
4. fetch new content for new region => 2!

Of course we can do all sorts of workarounds to break such feedback loops but it would be much easier if the mapView would let us know whether the region update was user initiated or not.


I should also add the Google Maps SDK for iOS has this feature in their -mapView:willMove: callback:

https://developers.google.com/maps/documentation/ios/reference/protocol_g_m_s_map_view_delegate-p

It's very valuable.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!