0

first question form me.

I'm trying to customize the default blue circle for the user position, but when I redefine the method mapView:viewForAnnotation I, in some way, generate an infinite loop:

The redefined method:

- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id )annotation {

MKPinAnnotationView *annotationView = [[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"Pin"];

if (annotation == mapView.userLocation) {
   annotationView.image = [UIImage imageNamed:@"user_pin.png"];
   annotationView.canShowCallout = YES;
   annotationView.animatesDrop = NO;

   return annotationView; // was return nil
}

annotationView.image = [UIImage imageNamed:@"other_pin.png"];
annotationView.canShowCallout = YES;
annotationView.animatesDrop = NO;
return annotationView;

}

Some ideas? Possibile causes?

Thanks in advance

Lucabro
  • 525
  • 3
  • 9
  • 30
  • Why do you think this generates an infinite loop? What happens exactly? Also, see [comment on this question](http://stackoverflow.com/questions/12067995/mkmapview-custom-image-not-updating-for-user-location-updating-using-kvo#comment16128102_12067995) (but ignore the KVO parts) and [this question](http://stackoverflow.com/questions/11432746/custom-annotation-view-for-userlocation-not-moving-the-mapview). Even though docs say you can override the MKUserLocation view, it doesn't seem to work. Linked questions have more info. –  Aug 24 '12 at 12:46
  • Solved, i've written code in the wrong area... my fault :) – Lucabro Sep 18 '12 at 13:59

0 Answers0