多個批註我有很多mkmapview.To註釋顯示上的MKMapView多個批註我使用的代碼上的MKMapView
MKMapRect zoomRect = MKMapRectNull;
for (id <MKAnnotation> annotation in self.mapView.annotations)
{
if([[annotation description]isEqualToString:@"Location"])
{
MKMapPoint annotationPoint = MKMapPointForCoordinate(annotation.coordinate);
MKMapRect pointRect = MKMapRectMake(annotationPoint.x, annotationPoint.y, 0, 0);
if (MKMapRectIsNull(zoomRect))
{
zoomRect = pointRect;
}
else
{
zoomRect = MKMapRectUnion(zoomRect, pointRect);
}
}
}
MKCoordinateRegion region = MKCoordinateRegionForMapRect(zoomRect);
[self.mapView setRegion:region animated:YES];
即使註釋在地圖上繪製,某些註釋被截斷。
你想加載多少個註釋? – kishore 2013-02-19 05:33:01
@ kishore:根據API迴應,我需要繪製 – 2013-02-19 06:48:15