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

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

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

最佳答案

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

    }

}

关于ios5 - MKPointAnnotation : title always visible.有可能吗?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/11313919/

10-14 07:52