How would you set a mapview to only show callout arrows on some of the annotations? Some of my annotations are for landmarks and do not need to display anything other than a title and subtitle.
Do they contain an object? For example, a custom made object, or a string you could make an custom init method with?
Then you can compare strings, to decide wether it should show call out or not.
DisplayMap *ann28 = [[DisplayMap alloc] init];
ann28.title = @"Freeman Tower";
ann28.subtitle = @"";
ann28.coordinate = tower;
[mapView addAnnotation:ann28];
-(MKAnnotationView *)mapView:(MKMapView *)mV viewForAnnotation:
(id <MKAnnotation>)annotation {
MKPinAnnotationView *pinView = nil;
if(annotation != mapView.userLocation)
{
static NSString *defaultPinID = @"com.invasivecode.pin";
pinView = (MKPinAnnotationView *)[mapView dequeueReusableAnnotationViewWithIdentifier:defaultPinID];
if ( pinView == nil ) pinView = [[[MKPinAnnotationView alloc]
initWithAnnotation:annotation reuseIdentifier:defaultPinID] autorelease];
pinView.pinColor = MKPinAnnotationColorRed;
pinView.canShowCallout = YES;
pinView.animatesDrop = YES;
UIButton *detailButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
[detailButton setTitle:annotation.title forState:UIControlStateNormal];
NSInteger annotationValue = [self.annotations indexOfObject:annotation];
detailButton.tag = annotationValue;
[detailButton addTarget:self action:@selector(showDetailView:) forControlEvents:UIControlEventTouchUpInside];
pinView.rightCalloutAccessoryView = detailButton;
return pinView;
}
else {
[mapView.userLocation setTitle:@"I am here"];
}
return pinView;
}
ann28.accessibilityHint = @"YES";
if (annotations.accessibilityHint == @"YES" {
pinView.pinColor = MKPinAnnotationColorRed;
pinView.canShowCallout = YES;
pinView.animatesDrop = YES;}
else {
pinView.pinColor = MKPinAnnotationColorRed;
pinView.canShowCallout = NO;
pinView.animatesDrop = YES;}