Possible Duplicate:
MKPinannotation detail disclosure button - present new view
Would any one lemme know how do i get an accessory button (Detail Disclosure) on a map pin and have some event on its click event. Thank you
Possible Duplicate:
MKPinannotation detail disclosure button - present new view
Would any one lemme know how do i get an accessory button (Detail Disclosure) on a map pin and have some event on its click event. Thank you
You can add accessory button to your pin using:
yourPinView.rightCalloutAccessoryView = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
When you click on accessory button this delegate will be invoked:
- (void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)view
calloutAccessoryControlTapped:(UIControl *)control
{
//do your stuff here
}
If you want some different then do
UIButton *DetailViewBtn = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
DetailViewBtn.tag = currentAnnotation.tag;
[DetailViewBtn setTitle:currentAnnotation.title forState:UIControlStateNormal];
[DetailViewBtn addTarget:self
action:@selector(annotationBtnPress:)
forControlEvents:UIControlEventTouchUpInside];
yourAnnotationView.rightCalloutAccessoryView = DetailViewBtn;
and your method here
-(IBAction)annotationBtnPress:(id)sender
{
NSLog(@"raj");
}