Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 211
kinghomer Avatar asked Jul 03 '12 15:07

kinghomer


1 Answers

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

    }

}
like image 146
Insider Avatar answered Nov 02 '22 16:11

Insider