Note that there are some explanatory texts on larger screens.

plurals
  1. POMy viewForAnnotation function is never called?
    primarykey
    data
    text
    <p>I have made these pieces of code for my custom annotation:</p> <pre><code> - (void)viewDidLoad { [super viewDidLoad]; mapView.delegate=self; [self AddLocations]; [self initiateMap]; ...... </code></pre> <p>this is my addLocation function:</p> <pre><code>-(id&lt;MKAnnotation&gt;)addAnnotationWithTitle: (NSString*) title coordinate:(CLLocationCoordinate2D) Location imageName:(NSString*) imageName{ CustomAnnotation *annotation = [[CustomAnnotation alloc]init]; annotation.title = title; annotation.subtitle = @"This is a subtitle"; [annotation setCoordinate:Location]; annotation.imageName = imageName; return annotation; } </code></pre> <p>and my CustomAnnotation Class:</p> <pre><code>-(MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id&lt;MKAnnotation&gt;)annotation{ NSLog(@"Test"); if([annotation isKindOfClass:[MKUserLocation class]]){ return nil; } if([annotation isKindOfClass:[CustomAnnotation class]]){ CustomAnnotation *customAnnotation = annotation; static NSString* annotationid = @"Annotation"; MKAnnotationView *annotationView = [mapView dequeueReusableAnnotationViewWithIdentifier:annotationid]; if(!annotationView){ annotationView = [[MKAnnotationView alloc]initWithAnnotation:annotation reuseIdentifier:annotationid]; annotationView.canShowCallout = YES; annotationView.rightCalloutAccessoryView = [UIButton buttonWithType:UIButtonTypeDetailDisclosure]; }else{ annotationView.annotation = annotation; } annotationView.image = [UIImage imageNamed:customAnnotation.imageName]; return annotationView; } return nil; } </code></pre> <p>For some reason the viewForAnnotation function is never used. Can anyone help me out here? Thanks</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload