iphone - setting up Image in MKAnnotationPinView -


I have the following code in the delegate:

  - (MKAnnotationView *) MapView: (MKMapView *) aMapView viewForAnnotation: (ID & lt; MKAnnotation & gt;) anAnnotation {MKPinAnnotationView * PIN = (MKPinAnnotationView *) [map dequeueReusableAnnotationViewWithIdentifier: @ "RoutePin"]; If (PIN == null) {if ([anAnnotation isKindOfClass: [RouteMapAnnotation class]]) {RouteMapAnnotation * theAnnotation = (RouteMapAnnotation *) anAnnotation; If (theNnotation.identifier == @ "Margpin") {// NSLog (@ "Testing Paint III"); Mkpinannottionviav * Strtnnotashanpin = [[Mkpinannottionviav light] Initvitannottion: Anannttion Reuseidentifiar: @ "Rutepin"]; UIButton * rightButton = [system with UIButton Button: UIButtonTypeDetailDisclosure]; StartAnnotationPin.canShowCallout = Yes; StartAnnotationPin.animatesDrop = YES; StartAnnotationPin.rightCalloutAccessoryView = rightButton; StartNnotationPin.pinColor = MKPinAnnotationColorRed; Return startup pin; } Else if (theAnnotation.identifier == @ "finishPin") {NSLog (@ "full work to create flag first"); Mkpinannottionviav * Finisnhnottionpin = [[Mkpinannottionviav light] Initvitannottion: Anannttion Reuseidentifiar: @ "Finishpin"]; Finish Annotation PincanShow = No; Ended annotation pin. Animatsdrop = Yes; // finish Anoteshnpinkaimj = [UIImage imageWithData: [NSData dataWithContentsOfURL: [NSURL URLWithString: @ "http://cdn4.iconfinder.com/data/icons/formula1/f1_png/128/checkered_flag.png"]]]; FinishAnnotationPin.image = [UIImage imageNamed: @ "flag_finish"]; Return endnote pin; }}} Return zero; }   

However this is not showing the image for the pin on the map. What am i missing

You should use MKAnnotationView instead of MKPinAnnotationView.

The PIN is for annotation pins.

Comments