I am using a mutable array to render annotations on a map ,, the problem is when I tap on the disclosure button in any annotation in the map I can't get the title of that annotation because I don't know how to get its index and I would like to print it in mapLabel ... but I can't find the index of this annotation
and Here is the code:
-(MKAnnotationView *) mapView:(MKMapView *)mapMKMapView viewForAnnotation: (id<MKAnnotation>)annotation
{
MKPinAnnotationView *MyPin=[[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"current"];
MyPin.pinColor = MKPinAnnotationColorPurple;
UIButton *adverButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
[adverButton addTarget:self action:@selector(button:) forControlEvents:UIControlEventTouchUpInside];
MyPin.rightCalloutAccessoryView = adverButton;
MyPin.draggable = YES;
MyPin.highlighted = YES;
MyPin.animatesDrop = TRUE;
MyPin.canShowCallout = YES;
return MyPin;
}
-(void)button:(id)sender
{
//mapLabel.text = @"Here is the chosen ann title";
}