2010-10-28 134 views

回答

2

首先從您的註釋數組中找到最小和最大經度和緯度。然後你可以設置區域:

MKCoordinateRegion extents; 
extents.center.latitude = (maxLat + minLat)/2.0; 
extents.center.longitude = (maxLong + minLong)/2.0; 
extents.span.latitudeDelta = (maxLat - minLat); 
extents.span.longitudeDelta = (maxLong - minLong); 
MKCoordinateRegion fittedRegion = [mapView regionThatFits:extents]; 
[mapView setRegion:fittedRegion animated:YES]; 
+0

謝謝,我希望有一些內置的MKMapView。但好的,再次感謝你 – 2010-10-28 19:49:17