/ Published in: Objective C
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.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
- (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; }
URL: http://stackoverflow.com/questions/1805897/iphone-annotation-image-disappears-on-touch