5

我添加标记和标题的代码是这样的:

MKPointAnnotation *annotationPoint = [[MKPointAnnotation alloc] init];
annotationPoint.coordinate = coord;
annotationPoint.title = currentTitle;
[mapView addAnnotation:annotationPoint];

是否可以在标记显示后立即在标记上显示标题并且始终可见?非常感谢

4

1 回答 1

11
MKPointAnnotation *annotationPoint = [[MKPointAnnotation alloc] init];
annotationPoint.coordinate = coord;
annotationPoint.title = currentTitle;
[mapView addAnnotation:annotationPoint];
[mapView selectAnnotation:annotationPoint animated:NO];

或者

- (void)mapView:(MKMapView *)map didAddAnnotationViews:(NSArray *)views{

    for (MKAnnotationView *av in views){

        if ([av.annotation isKindOfClass:[MKPointAnnotation class]]){
            [mapView selectAnnotation:av.annotation animated:NO];
            break;
        }

    }

}
于 2012-10-08T09:47:28.883 回答