2011-01-05 88 views
0

当我使用这个:显示selectedAnnotation信息

- (void)mapView:(MKMapView *)myMapView annotationView:(MKAnnotationView *)view 
     calloutAccessoryControlTapped:(UIControl *)control 
{ 
    NSLog(@"SelectedAnnotations is %@", myMapView.selectedAnnotations); 
} 

它会显示这个在日志中。

"<Annotation: 0x586cdb0>" 

现在这是一个奇怪的问题,但是我如何从这个注释中获取信息呢?我失去了理智。

这是注释中的内容。

myAnnotation = [[Annotation alloc] init]; 
myAnnotation.dealName=[NSString stringWithFormat:@"%@",[tempValue objectForKey:@"name"]]; 
myAnnotation.subName=[NSString stringWithFormat:@"Price: $%@",[tempValue objectForKey:@"price"]]; 
myAnnotation.latitude = [NSNumber numberWithDouble:[[tempValue objectForKey:@"dealLatitude"] doubleValue]]; 
myAnnotation.longitude = [NSNumber numberWithDouble:[[tempValue objectForKey:@"dealLongitude"] doubleValue]]; 
myAnnotation.dealId = [NSNumber numberWithInt:[ [tempValue objectForKey:@"dId"] intValue ]]; 

感谢您的帮助。

回答

0

在calloutAccessoryControlTapped,拍了拍标注在MKAnnotationView参数可用:

Annotation *myAnnotation = (Annotation *)view.annotation; 
+0

你是我的英雄再用!!!!!!!!!!!!!!!!!!我的大脑在哪里。 – 2011-01-05 20:25:17