Determine if MKMapView has been moved or enlarged

I just need a way to differentiate between these two events while playing with the map:

  • dragging the map.
  • scaling the map.

Thank,

+3


source to share


2 answers


MKMapView

is not based on UIScrollView

, so it doesn't call methods UIScrollViewDelegate

. However, you can create instances of UIPanGestureRecognizer

and UIPinchGestureRecognizer

, add them to your map view and work with their action methods.



+3


source


inside the MKMapView delegation methods:

- (void)mapView:(MKMapView *)mapView region{Will,Did}ChangeAnimated:(BOOL)animated

      

compare the "new" range with the "old" one. Something like



MKZoomScale currentZoomScale = (CGFloat)(map.bounds.size.width / map.visibleMapRect.size.width);

      

For more information, see the BreadCrumb sample project.

http://developer.apple.com/library/ios/#samplecode/Breadcrumb/Listings/Classes_BreadcrumbViewController_m.html

+3


source







All Articles