views:

16

answers:

0

I have a problem using the -(void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)view calloutAccesoryControlTapped:(UIControl *)control method. I tried many ways to test it but it just won't appear. Can anyone find a mistake

-(MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)anno{
    MKPinAnnotationView *retval=nil;
    if(retval ==nil){
        retval=[[[MKPinAnnotationView alloc]initWithAnnotation:anno reuseIdentifier:@"Annotations"]autorelease];
        UIButton *disclosure=[UIButton buttonWithType:UIButtonTypeDetailDisclosure];
        retval.rightCalloutAccessoryView=disclosure;
        [retval setPinColor:MKPinAnnotationColorGreen];
        retval.animatesDrop=YES;
        retval.canShowCallout=YES;
    }
    return retval;
}
-(void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)view calloutAccesoryControlTapped:(UIControl *)control{
    NSLog(@"Tap");
    PhotoDetail *detail=[[PhotoDetail alloc]initWithNibName:@"PhotoDetail" bundle:nil];
    UINavigationController *nav=[[UINavigationController alloc]initWithRootViewController:detail];
    [self presentModalViewController:nav animated:YES];
}