我試圖通過Google Places API將當前已加載到註釋中的數據傳遞到我通過使用segue的故事板創建的詳細視圖控制器中。將數據從註釋傳遞到詳細視圖iOS使用故事板
我已經正確加載詳細視圖控制器,點擊每個註釋的詳細信息,但我試圖讓數據現在通過。
- (void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)view calloutAccessoryControlTapped:(UIControl *)control
{
// Assuming I call the MapPoint class here and set it to the current annotation
// then I'm able to call each property from the MapPoint class but wouldn't
// I have to set this in the prepareForSegue but that would be out of scope?
MapPoint *annView = view.annotation;
// annView.name
// annView.address
[self performSegueWithIdentifier:@"showBarDetails" sender:view];
}
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if([[segue identifier] isEqualToString:@"showBarDetails"])
{
BarDetailViewController *bdvc = [self.storyboard instantiateViewControllerWithIdentifier:@"showBarDetails"];
//This parts confusing me, not sure how I obtain the data
// from the above mapView delegation method?
// annView.name = bdvc.name;
bdvc = segue.destinationViewController;
}
}
我能夠輕鬆地做到這一點,而無需使用一個故事板和筆尖..但我想學習如何使用純故事板。 – user3117785