Return to Snippet

Revision: 26543
at April 30, 2010 09:14 by espinallab


Initial Code
- (MKAnnotationView *)mapView:(MKMapView *)newMapView viewForAnnotation:(id )newAnnotation {
    MKAnnotationView *a = [ [ MKAnnotationView alloc ] initWithAnnotation:newAnnotation reuseIdentifier:@"currentloc"];
    if ( a == nil )
        a = [ [ MKAnnotationView alloc ] initWithAnnotation:newAnnotation reuseIdentifier: @"currentloc" ];
    a.image = [ UIImage imageNamed:@"anno.png" ];
    a.canShowCallout = YES;
    a.rightCalloutAccessoryView = [ UIButton buttonWithType:UIButtonTypeDetailDisclosure ];
    UIImageView *imgView = [ [ UIImageView alloc ] initWithImage:[ UIImage imageNamed:@"bus_stop_30x30.png" ] ];
    a.leftCalloutAccessoryView = imgView;
    return a;
}

Initial URL
http://stackoverflow.com/questions/1805897/iphone-annotation-image-disappears-on-touch

Initial Description
Answering my own question here, just in case others have the same issue. Notice that I am using "MKPinAnnotationView" - it should be changed to "MKAnnotationView" and everything works.

Initial Title
Adding a custom Pin Annotation MAPKit

Initial Tags

                                

Initial Language
Objective C