Get info on a mapview selected annotation

泪湿孤枕 提交于 2019-12-02 03:35:40

This is how

 for (id annotation in mapView.annotations) {NSLog([annotation title]);}

Here is what I did in the annotationviewClick function:

Hope this helps

-(IBAction) annotationViewClick:(id) sender{

    [self.view addSubview:LoadingView];
    Annotation *ann = [myMap.selectedAnnotations objectAtIndex:([myMap.selectedAnnotations count]-1)];


    NSLog(@"Selected:%@", [ann tag]);

}

mapView.selectedAnnotations returns an array of anotations. You should access its items to get info.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!