Iām not sure why this will work earlier, but the animation probably requires the creation and preparation of annotations, which is unlikely immediately after adding the annotation.
What you can do is move the selection to the didAddAnnotationViews
delegate didAddAnnotationViews
, which should work on all versions of iOS:
- (void)mapView:(MKMapView *)mapView didAddAnnotationViews:(NSArray *)views { for (MKAnnotationView *av in views) { if ([av.annotation isKindOfClass:[MapAnnotations class]]) { MapAnnotations *pushpin = (MapAnnotations *)av.annotation; if (_this_pushpin_is_the_one_to_select) { [mapView selectAnnotation:av.annotation animated:YES]; break;
source share