开发者

iPhone: Question about touch events for map views

I have a mapView which has a couple of mapAnnotations. Id like to record the event when the user touches on a mapAnnoatation and then Id like to capture the information from that particular annotation and save it. I came up with the following code to get started. But I do not see any output on my console after I build and run and the tap on an annotation on my device.

What am I doing wrong?

开发者_StackOverflow
- (void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)view     calloutAccessoryControlTapped:(UIControl *)control
{
LocationMapAnnotation *tempAnnotation = view.annotation;
NSLog(@"The tapped annotation was %@", tempAnnotation.title);
}


From what I can remember, that particular method will only be called when an accessory view on an Annotation's callout view is tapped; so, for example, if you tap the blue icon in this screenshot:

iPhone: Question about touch events for map views

By implementing the method

- (void)mapView:(MKMapView *)mapView didSelectAnnotationView:(MKAnnotationView *)view

you should hopefully be able to achieve what you're after.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜