MKPointAnnotation:标题始终可见。可能吗?

时间:2012-07-03 15:11:40

标签: ios5 map mkmapview mkannotation mapkit

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

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

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

1 个答案:

答案 0 :(得分:10)

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

OR

- (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;
        }

    }

}