Ant*_*y C 11 iphone annotations map
我正在我的地图视图上加载注释.加载地图时,注释显示为引脚.
但是,标题和副标题不会自动出现在引脚上.目前,用户需要在标题显示之前点击引脚.
有没有办法在加载地图时让标题自动显示在引脚上?
(这个问题几乎是一样的,但不完全相同:在iphone中显示当前loaction的标题,因为我已经在我的对象中定义了-title和-subtitle属性.)
谢谢
- (void)mapView:(MKMapView *)mv didAddAnnotationViews:(NSArray *)views
{
MKAnnotationView *annotationView = [views objectAtIndex:0];
id<MKAnnotation> mp = [annotationView annotation];
MKCoordinateRegion region = MKCoordinateRegionMakeWithDistance([mp coordinate] ,350,350);
[mv setRegion:region animated:YES];
[mapView selectAnnotation:mp animated:YES];
}
Run Code Online (Sandbox Code Playgroud)
如果您正在执行调用setRegion方法的相同操作,请确保调用
[mapView selectAnnotation:mp animated:YES];
Run Code Online (Sandbox Code Playgroud)
后
[mv setRegion:region animated:YES];
Run Code Online (Sandbox Code Playgroud)