calloutAccessoryControlTapped未调用/触发

vic*_*cky 5 mapkit

我在我的应用程序中使用了这个例子,

http://spitzkoff.com/craig/?p=81

但它没有调用/触发calloutAccessoryControlTapped,因为我点击了配件控件.

这是我的代码.

- (void)viewDidLoad {
    MapAnnotation *annotation = nil;
    annotation = [[MapAnnotation alloc] initWithCoordinate:[[trackPointsArray objectAtIndex:trackPointsArray.count - 2] coordinate]];
    [mapView addAnnotation:annotation];
    [super viewDidLoad];
}

- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation
{
    MKAnnotationView *annotationView = nil;

    // start pin
    static NSString *StartPinIdentifier = @"StartPinIdentifier";
    MKPinAnnotationView *startPin = [annotationView dequeueReusableCellWithIdentifier:StartPinIdentifier];

    if (startPin == nil) {
        startPin = [[[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:StartPinIdentifier] autorelease];
        startPin.animatesDrop = YES;
        startPin.pinColor = MKPinAnnotationColorGreen;
        startPin.rightCalloutAccessoryView = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
        startPin.canShowCallout = YES;
        startPin.enabled = YES;

        UIImage *image = [UIImage imageNamed:@"location.png"];
        UIImageView *imgView = [[UIImageView alloc] initWithImage:image];
        startPin.leftCalloutAccessoryView = imgView;
    }

    annotationView = startPin;
    return annotationView;
}

- (void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)view calloutAccessoryControlTapped:(UIControl *)control
{
     NSLog(@"calloutAccessoryControlTapped");
}
Run Code Online (Sandbox Code Playgroud)

我一直在努力解决这个问题,似乎很多人也有同样的问题.任何帮助,将不胜感激.谢谢

vic*_*cky 0

问题解决了!我的另一个视图挡住了地图视图。[自我设置用户交互启用:否];