MKAnnotationView Push-to-View-Controller, wenn auf die DetailDesclosure-Schaltfläche geklickt wird
Ich möchte die Ansicht wechseln, wenn ein DetailDisclosure auf einer Karte angeklickt wird, die ich gerade anzeige. Mein aktueller Code ist wie folgt:
- (void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)view
calloutAccessoryControlTapped:(UIControl *)control
{
DetailViewController *detailViewController = [[DetailViewController alloc]
initWithNibName:@"DetailViewController" bundle:nil];
detailViewController.title = dictionary[@"placeLatitude"]
[self.navigationController pushViewController:detailViewController animated:YES];
}
Damit kann ich auf den View-Controller zugreifen, aber ich habe nicht herausgefunden, wie er gezwungen werden kann, Details aus dem JSON-Array zu ziehen, das ursprünglich zum Generieren der Karte verwendet wurde. Ich ziehe Daten wie diese, um die Karte zu generieren:
for (NSDictionary *dictionary in array)
{
// retrieve latitude and longitude from the dictionary entry
location.latitude = [dictionary[@"placeLatitude"] doubleValue];
location.longitude = [dictionary[@"placeLongitude"] doubleValue];
//CAN I LOAD THE TITLE/ID OF THE LOCATION HERE?
Ich weiß, ich bin ein bisschen vom Ziel entfernt. Vielleicht hilft schon ein Tritt in die richtige Richtung. Vielen Dank!