title: How can I get which annotation UIButtonTypeDetailDisclosure clicked in objective c?
body: <p>I want to do detail view when click the annotation's detail button. But each pin must be have different detail view. To do this, I try to set tag to buttons. And then I will use this tags at calloutAccessoryControlTapped method for add their detail view. My code below. But it is stopped at for loop. How can I solve this?</p>
  
  <pre><code>- (MKAnnotationView *) mapView:(MKMapView *)mapView viewForAnnotation:(id &lt;MKAnnotation&gt;) annotation
  {
  static NSString *annReuseId = @"test";
  
  MKPinAnnotationView *annView = (MKPinAnnotationView *)[mapView dequeueReusableAnnotationViewWithIdentifier:annReuseId];
  if (annView == nil)
  {
      annView = [[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:annReuseId];
  
      annView.animatesDrop = YES;
      annView.canShowCallout = YES;
      [annView setSelected:YES];
      UIButton *detailButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
      annView.rightCalloutAccessoryView=detailButton;
      for (int i=0; i&lt;=[[mapView annotations] count]; i++)
      {
          detailButton.tag =[[[mapView annotations] objectAtIndex: i] integerValue];
          NSLog(@"button %i",detailButton.tag);
  
      }
  }
  else {
      annView.annotation = annotation;
  
  }
  
  return annView;
  }
  - (void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)view calloutAccessoryControlTapped:(UIControl *)control
  {
  
  
  NSLog(@"calloutAccessoryControlTapped: annotation = %@", view.annotation);
  RestaurantsView *detailView=[[RestaurantsView alloc] initWithNibName:@"RestaurantsView" bundle:nil];
     //here, can set annotation info in some property of detailView
     // [[self navigationController] pushViewController:detailView animated:YES];
     // [detailView release];
  [self.view addSubview:detailView.view];
  }
  </code></pre>