2009-07-29 8 views
5

He utilizado este ejemplo en mi solicitud,calloutAccessoryControlTapped no llamados/desencadenaron

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

pero no llamar/activación de la calloutAccessoryControlTapped mientras hacía tapping la accessorycontrol.

Aquí está mi código.

- (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"); 
} 

He estado luchando con este problema por un tiempo, parece que mucha gente está teniendo el mismo problema también. Cualquier ayuda sería apreciada. Gracias

Respuesta

0

¡Problema resuelto! Mi otra vista estaba bloqueando la vista de mapa. [self setUserInteractionEnabled: NO];

Cuestiones relacionadas