I want to show a custom message instead of \"My Location\" in viewForAnnotation. How do I do this?
Thanks Deshawn
It can be done by updating Title
property of MKUserLocation
.
As MKAnnotation
protocol doesn't require making Title
a property, cast annotation passed as an argument to MKUserLocation
and set the property
- (MKAnnotationView*)mapView:(MKMapView *)mapView viewForAnnotation: (id)annotation {
if ([annotation isKindOfClass:[MKUserLocation class]]) {
[(MKUserLocation*)annotation setTitle: @"I am here"];
return nil;
}
return nil;
}