I would like to set a custom image instead of the normal pin on a Map. I also want it to be able to be opened and add the drop annimation for each one.
Any suggestion?
EDIT: Here is all I have
- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(ActivityAnnotation *)annotation
{
static NSString* AnnotationIdentifier = @"AnnotationIdentifier";
MKPinAnnotationView* pinView = [[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:AnnotationIdentifier];
pinView.animatesDrop=YES;
pinView.canShowCallout=YES;
UIImage *image = [UIImage imageNamed:@"Map_Pin"];
pinView.image = image;
UIImageView *imageView = [[UIImageView alloc] initWithImage:image];
imageView.frame = CGRectMake(-2.5,6,27,30);
[pinView addSubview:imageView];
UIButton* rightButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
rightButton.tag = [activities indexOfObject:annotation.activity];
[rightButton addTarget:self action:@selector(showDetails:) forControlEvents:UIControlEventTouchUpInside];
pinView.rightCalloutAccessoryView = rightButton;
return pinView;
}
Everything works fine, but the original pin keeps getting displayed behind my default image. How can I erase it?