0

Is it possible to know when mapView will complete the drawing a map after calling setRegion method?

I show the HUD before calculating region parameters:

[SVProgressHUD showWithStatus:@"Finding"];

MKCoordinateRegion newRegion;

newRegion.center.latitude     = (maxLat + minLat) / 2;
newRegion.center.longitude    = (maxLon + minLon) / 2;
newRegion.span.latitudeDelta  = maxLat - minLat;
newRegion.span.longitudeDelta = maxLon - minLon;

then setting a new region and hiding the HUD:

[self.mapView setRegion:newRegion animated:NO];
[SVProgressHUD dismiss];

But HUD dismisses faster than a new region appears on the map. How to dismiss the HUD after drawing? Is it any callback for setRegion?

akrisanov
  • 3,212
  • 6
  • 33
  • 56

3 Answers3

1

– mapViewDidFinishLoadingMap: of MKMapViewDelegate can be used to execute code after loading of the map finished.

pre
  • 3,475
  • 2
  • 28
  • 43
1

MKMapViewDelegate has mapView:regionDidChangeAnimated: that will be called when your MKMapView has moved to the specified region.

ref: http://developer.apple.com/library/ios/#DOCUMENTATION/MapKit/Reference/MKMapViewDelegate_Protocol/MKMapViewDelegate/MKMapViewDelegate.html

Craig
  • 8,093
  • 8
  • 42
  • 74
-2

[SVProgressHUD performSelector:@selector(dismiss) withObject:nil afterDelay:0.5]; Details in the docs

Templar
  • 1,694
  • 1
  • 14
  • 32