v.leftCalloutAccessoryView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"img"]];
where v is the view of your annotation (MKAnnotationView) Or if you want a complete solution, here it is:
- (MKAnnotationView *) mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>) annotation{
NSString *Identifier = [NSString stringWithFormat:@"%f%f",annotation.coordinate.latitude,annotation.coordinate.longitude];
MKPinAnnotationView *annView= (MKPinAnnotationView *)[self.mapView dequeueReusableAnnotationViewWithIdentifier:Identifier];
if (annView==nil) {
annView = [[[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:Identifier] autorelease];
}
if (![annotation isKindOfClass:[MyAnnotation class]]) {
return nil;
}
RightCalloutAccessoryBtn* rightButton = [RightCalloutAccessoryBtn buttonWithType:UIButtonTypeDetailDisclosure];
annView.rightCalloutAccessoryView = rightButton;
annView.leftCalloutAccessoryView = [[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"img"]] autorelease];
annView.canShowCallout = YES;
return annView;
}
You must write this code in your delegate card class.
source
share