Reputation: 666
In my app there are multiple annotations.
MapLocation *annotation = [[MapLocation alloc] initWithDictionary:tempDict];
[mapView addAnnotation:annotation];
[annotation release];
MapLocation is the class where i save the information like city,zip,country,address.
There is detailDisclosureButton in the callout of every annotation. This button loads antoher view(ATM_Details).When i tapp detailDisclosureButton i need to pass information corresponding to that annotation to the the class ATM_Details.
This problem drives me nuts. Any help would be appreciated.
I thought to use method
- (void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)view calloutAccessoryControlTapped:(UIControl *)control
But i do not have any idea what to implement in this method.
Upvotes: 0
Views: 825
Reputation: 51374
MKMapViewDelegate has a method mapView:annotationView:calloutAccessoryControlTapped:. You can implement this method and get the corresponding annotation by reading the annotation property of the view parameter.
- (void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)view calloutAccessoryControlTapped:(UIControl *)control {
MapLocation *annotation = (MapLocation *) [view annotation];
// Get the necessary data from the annotation and pass it to ATM_Details
Upvotes: 2
Reputation: 716
You can assign tagValue for each button's, and based on the tagValue You can pass the corresponding information to another view.
Upvotes: 0