Maystro
Maystro

Reputation: 2955

determine if MKMapView was dragged or zoomed

I just need a way to differentiate between this 2 events while playing with the map:

  1. dragging the mapview
  2. zooming the mapview

Thanks,

Upvotes: 3

Views: 1593

Answers (2)

Kyr Dunenkoff
Kyr Dunenkoff

Reputation: 8090

MKMapView is not based on UIScrollView so it doesn't call UIScrollViewDelegate methods. But nonetheless, you can instantiate UIPanGestureRecognizer and UIPinchGestureRecognizer, add them to your map view and work with their action methods.

Upvotes: 3

blub
blub

Reputation: 1014

inside MKMapView delegate methods:

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

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

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

in the BreadCrumb Sample Project.

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

Upvotes: 3

Related Questions