I am trying to update one of my applications on iOS7. The problem is that on mine MKMapView
, when I click on the output, it shows Callout
, but when I click on it , rightCalloutAccessoryView
it no longer sends a callback to the delegate. Thus, I can no longer put forward a detailed view.
It worked great on iOS6, no longer works on iOS7.
Here is the relevant piece of code:
- (MKAnnotationView *) mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation {
if ([annotation isKindOfClass:[MKUserLocation class]]) {
return nil;
}
NSString * annotationIdentifier = nil;
if ([annotation isKindOfClass:VPStation.class]) {
annotationIdentifier = @"stationAnnotationIdentifier";
}
if (!annotation) {
return nil;
}
MKPinAnnotationView * annotationView = [(MKPinAnnotationView *)[mapView dequeueReusableAnnotationViewWithIdentifier:annotationIdentifier] retain];
if(annotationView == nil) {
annotationView = [[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:annotationIdentifier];
annotationView.canShowCallout = YES;
annotationView.rightCalloutAccessoryView = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
annotationView.image = [UIImage imageNamed:@"MyAnnotationPin"];
annotationView.centerOffset = CGPointMake(-10.0f, 0.0f);
}
annotationView.annotation = annotation;
return [annotationView autorelease];
}
- (void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)view calloutAccessoryControlTapped:(UIControl *)control {
if ([view.annotation isKindOfClass:VPStation.class]) {
VPTotalDetailViewController * detailVC = [[VPTotalDetailViewController alloc] initWithStation:(VPStation *)view.annotation
andUserLocation:self.mapView.userLocation.coordinate];
[self.navigationController pushViewController:detailVC animated:YES];
[detailVC release];
}
}
According MKAnnotationView
to the class reference:
UIControl, . UIControl, .
- , UIView
, detailViewController? , Apple ? , , ?