0
如何將UIMapView
圍繞array
的MKAnnotation
?如何圍繞MKAnnotation數組圍繞UIMapView?
如何將UIMapView
圍繞array
的MKAnnotation
?如何圍繞MKAnnotation數組圍繞UIMapView?
首先從您的註釋數組中找到最小和最大經度和緯度。然後你可以設置區域:
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];
謝謝,我希望有一些內置的MKMapView。但好的,再次感謝你 – 2010-10-28 19:49:17