如果你只有一个注释,这是最简单的方法:
[mapView selectAnnotation:[mapView.annotations objectAtIndex:0] animated:true];
注意:如果你启用了针掉在地上的动画,这禁用它。基本上,它在添加到地图视图后立即选择注释,以便切断动画。
如果您想在选择之前等待引脚放置动画完成,请继续使用它。首先,确保你的视图控制器设置为MKMapViewDelegate,然后:
- (void)mapView:(MKMapView *)mapView didAddAnnotationViews:(NSArray *)views {
NSTimer *timer = [NSTimer scheduledTimerWithTimeInterval:.7 target:self selector:@selector(pinDropped) userInfo:nil repeats:NO];
}
- (void) pinDropped {
[mapView selectAnnotation:[mapView.annotations objectAtIndex:0] animated:true];
}
你介意在那里抛出一个代码示例吗? – Zak 2010-08-20 14:11:34
任何简单的方法来显示多个注释? – user1872384 2015-06-04 07:47:06