I have successfully used the Google Places API to display annotations on my map view. Now I'd like this information (name & address) to be sent to a detail view controller.
For now I only have a blank detail view controller with no information on it.
Here is the method with which I call the detail view controller:
-(void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)view calloutAccessoryControlTapped:(UIControl *)control {
id <MKAnnotation> annotation = [view annotation];
if ([annotation isKindOfClass:[MapPoint class]])
{
NSLog(@"success");
}
[self performSegueWithIdentifier:@"ABC" sender:self];
}
And this is the method in which I try to "pass" the information to the detail view controller:
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if ([segue.identifier isEqualToString:@"ABC"])
{
MKAnnotationView *annotationView = sender;
[segue.destinationViewController setAnnotation:annotationView.annotation];
}
}
The detail view controller is displayed but with no information in it! I know I must be missing something dumb but I cannot figure what!