我有这段代码,在 iOS6 中,我在地图视图的中心将标记居中,在 iOS 7 中不会发生,为什么?
- (void)mapView:(MKMapView *)mapView didAddAnnotationViews:(NSArray *)views {
MKMapRect zoomRect = MKMapRectNull;
for (id <MKAnnotation> annotation in mapView.annotations)
{
MKMapPoint annotationP = MKMapPointForCoordinate(annotation.coordinate);
MKMapRect pointRect = MKMapRectMake(annotationP.x, annotationP.y, 7000, 7000);
if (MKMapRectIsNull(zoomRect)) {
zoomRect = pointRect;
} else {
zoomRect = MKMapRectUnion(zoomRect, pointRect);
}
}
[mapView setVisibleMapRect:zoomRect animated:YES];
}