Reputation: 813
I am trying to replace the standard pin for a custom pin. In iOS 6 the following code works and replaces it perfectly!
static NSString* AnnotationIdentifier = @"AnnotationIdentifierDealer";
MKPinAnnotationView* pinView = [[[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:AnnotationIdentifier] autorelease];
pinView.animatesDrop=YES;
pinView.canShowCallout=YES;
UIImageView *newPin = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"newpin.png"]];
pinView.image = newPin.image;
The above code does not work in iOS5 (it shows the original pins)....I am able to add a image over the original pin, unfortunately this does not work since the shape of the custom pin is different. I was able to add it over the pin in ios 5 withthe following code
UIImageView *newPin = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"newpin.png"]];
[pinView addSubView:newPin];
How am I able to replace the original pin. It should run on iOS5+6
Upvotes: 0
Views: 115
Reputation: 8294
You could try using MKAnnotationView instead of MKPinAnnotationView as described here : https://stackoverflow.com/a/9815650/186212
Upvotes: 1