On viewload
I am looping over some data and adding point points:
for (id venue in venues) {
MKPointAnnotation *point = [[MKPointAnnotation alloc] init];
point.coordinate = coords here;
point.title = @"title"
point.subtitle = @"sub";
[self.map addAnnotation:point];
}
What I'm trying to do is add a simple disclosure button to the Annotation. I'm using the following:
- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation {
MKAnnotationView *annotationView = [mapView dequeueReusableAnnotationViewWithIdentifier:@"String"];
if(!annotationView) {
annotationView = [[MKAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"String"];
annotationView.rightCalloutAccessoryView = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
}
annotationView.enabled = YES;
annotationView.canShowCallout = YES;
return annotationView;
}
However after the view loads, the pinpoints are no longer showing. If I remove the viewForAnnotation
everything loads in right, however I of course don't have a disclosure button.
What am I doing wrong here?