kinghomer
kinghomer

Reputation: 3161

MKPointAnnotation: title always visible. Is it possible?

My code for adding a marker and title is this:

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

Is it possible to show title on marker immediately after marker is shown and always visible ? Thanks much

Upvotes: 5

Views: 3860

Answers (1)

Insider
Insider

Reputation: 189

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

    }

}

Upvotes: 11

Related Questions