I\'ve been searching for a similar solution on how to design a custom MKAnnotationView like this one.
- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id )annotation {
static NSString *AnnotationViewID = @"annotationViewID";
MKAnnotationView *annotationView = (MKAnnotationView *)[mapView dequeueReusableAnnotationViewWithIdentifier:AnnotationViewID];
if (annotationView == nil)
{
annotationView = [[MKAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:AnnotationViewID];
}
UIImage *imgPinBorder = [UIImage imageNamed:@"pinBorder.png"];
UIImageView *imageViewPinBorder = [[UIImageView alloc] initWithImage:imgPinBorder];
imageViewPinBorder.center = annotationView.center;
[annotationView addSubview:imageViewPinBorder];
UIImage *img = [UIImage imageNamed:@"myIcon.png"];
UIImageView *imageView = [[UIImageView alloc] initWithImage:img];
imageView.center = annotationView.center;
[annotationView addSubview:imageView];
annotationView.annotation = annotation;
UIButton* rightButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
[rightButton addTarget:self action:nil forControlEvents:UIControlEventTouchUpInside];
[rightButton setTitle:annotation.title forState:UIControlStateNormal];
annotationView.rightCalloutAccessoryView = rightButton;
annotationView.canShowCallout = YES;
annotationView.draggable = NO;
return annotationView;
}