Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MKAnnotationView viewForAnnotation never called

Tags:

after i spend 2 days of searching the bug i have to ask for help here. i do have MapViewController and place some pins on the map. i´ve copied most of the code from MapCallouts and WeatherMap of the apple code samples.

anyhow it seems that i´ve deleted or missed essential parts. it seems there is no connection between the MapViewController and the following code

- (MKAnnotationView *)mapView:(MKMapView *)theMapView viewForAnnotation:(id <MKAnnotation>)annotation
{
    NSLog(@"MKAnnotationView");
    return nil;
}

setting an annotation looks like this and it works well:

- (void)createPoi:(CLLocationCoordinate2D)theCoordinate
{
    NSLog(@"createPoi");

    RandomAnnotation *randomAnnotation = [[RandomAnnotation alloc] init];
    [randomAnnotation setTheCoordinate:theCoordinate];
    [randomAnnotation setTheTitle:@"bla"];
    [randomAnnotation setTheSubTitle:@"bla"];
    [self.mapAnnotations insertObject:randomAnnotation atIndex:kRandomAnnotationIndex];
    [randomAnnotation release];
    [self.mapView addAnnotation:[self.mapAnnotations objectAtIndex:kRandomAnnotationIndex]];
}

i can´t figure out what's wrong. could anybody give me a hint what´s missing? i have to admit that i don´t have any experience with the delegate pattern.