Search code examples
iphonemkmapviewcallouts

I don't know how to work with calloutAccessoryControlTapped:(UIControl *)control


in my project are two classes (mapViewcontroller and listViewcontroller) and on the mapView are a lot of pins that the user can pull. If he pulled one i have to save the data of the pins and manage it to the other class. so my question what i have to implement in the following method to save the title and subtitle of the pin and use it on the other class???

enter code here- (void) mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)annView calloutAccessoryControlTapped:(UIControl *)control {

NSLog(@"Pin gedrückt und gespeichert!", [annView description]); }

sorry about my bad english, i hope you can help me??

greetings


Solution

  • Well, you can get the title and subtitle like this:

    NSString *pinTitle=view.annotation.title;
    NSString *pinSubtitle=view.annotation.subtitle;
    

    To put them in a NSMutableDictionary or similar in another viewcontroller, use one of the methods recommended in the threads about sharing/accessing variables in another viewcontroller.