2009-07-29 12 views
5

Użyłem tego przykładu w mojej aplikacjicalloutAccessoryControlTapped nie zwani/wyzwalany

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

ale jej nie dzwoni/wyzwalania calloutAccessoryControlTapped jak i stuknął accessorycontrol.

Oto mój kod.

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

Od pewnego czasu borykam się z tym problemem, wydaje się, że wiele osób ma ten sam problem. Każda pomoc będzie doceniona. Dzięki

Odpowiedz

0

Problem rozwiązany! Mój inny widok blokował widok mapy. [self setUserInteractionEnabled: NO];

Powiązane problemy