Reputation: 513
When I click on the pin, annotation view is opened with detailed disclosure button.
When I touch detailed disclosure button next view is called,I need same functionality when I touch on annotation.
Upvotes: 3
Views: 9249
Reputation: 11452
There is one delegate method in MKMapViewDelegate, When you select an annotation this method will help you to track which annotation got selected and than you may message to any selector you want ;).
mapView:didSelectAnnotationView:
Tells the delegate that one of its annotation views was selected.
- (void)mapView:(MKMapView *)mapView didSelectAnnotationView:(MKAnnotationView *)view
Parameters
mapView
The map view containing the annotation view. view The annotation view that was selected. Discussion
You can use this method to track changes in the selection state of annotation views.
Availability Available in iOS 4.0 and later. Declared In MKMapView.h
Upvotes: 6
Reputation: 991
You can use this code -
UIButton* rightButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
rightButton.tag = annotationIndex;
[rightButton addTarget:self action:@selector(showDetails:) forControlEvents:UIControlEventTouchUpInside];
pinView.rightCalloutAccessoryView = rightButton;
In this "showDetails" should be your custom IBAction in which you code your functionality.
Upvotes: 2