我已成功使用Google Places API在地图视图中显示注释。现在,我希望将此信息(名称和地址)发送到详细视图控制器。
现在我只有一个空白的详细信息视图控制器,但没有相关信息。
以下是我调用详细视图控制器的方法:
-(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];
}
这是我尝试将信息“传递”到详细视图控制器的方法:
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if ([segue.identifier isEqualToString:@"ABC"])
{
MKAnnotationView *annotationView = sender;
[segue.destinationViewController setAnnotation:annotationView.annotation];
}
}
显示详细视图控制器但没有信息!我知道我必须遗漏一些愚蠢的东西,但我无法想象什么!