-(MKAnnotationView *)mapView:(MKMapView *)mV viewForAnnotation:(id <MKAnnotation>)annotation {
pinView = nil;
if(annotation != map.userLocation)
{
NSString *defaultPinID =@"com.invasivecode.pin1";
pinView = (MKPinAnnotationView *)[map dequeueReusableAnnotationViewWithIdentifier:defaultPinID];
if ( pinView == nil ) pinView = [[[MKPinAnnotationView alloc]
initWithAnnotation:annotation reuseIdentifier:defaultPinID] autorelease];
UIButton *btnGo = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
[btnGo addTarget:self action:@selector(goToLocation:) forControlEvents:UIControlEventTouchUpInside];
pinView.rightCalloutAccessoryView=btnGo;
pinView.canShowCallout = YES;
pinView.animatesDrop = YES;
pinView.draggable=NO;
}
else {
[map.userLocation setTitle:@"I am here"];
}
return pinView;
}
Declare this in .h file
MKPinAnnotationView *pinView