开发者

multiple annotation have issue to get selected index annotation

I have displayed multiple annotation successfully in mapView in my iphone application, but I have problem too .. In top of the screen I have two Tab Map and List . map display all annotation in map and list display those data in Tableview which is display in map. when I click on particular cell i get all the particular de开发者_如何学Gotail of that cell.but when I try to get id from Tap annotation my array getting lots of id after comparison of name because we have same name in my array list so how can I differentiate from annotation tag. How to set tag of annotations ?


In the calloutAccessoryControlTapped delegate method, use view.annotation to access the annotation that was tapped.

If you have a custom annotation class, you can cast it to easily access the properties (you may also want to first check if the annotation tapped is an instance of the class you're interested in--important if you're using multiple annotation classes):

if ([view.annotation isKindOfClass:[TagMark class]]) {
    TagMark *tm = (TagMark *)view.annotation;
    NSLog(@"tm.someProperty = %@", tm.someProperty);
}
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜