获取有关地图视图选定注释的信息 [英] Get info on a mapview selected annotation

查看:23
本文介绍了获取有关地图视图选定注释的信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在地图视图和标注上有注释,每个标注上都有一个按钮.我需要做的是从这个标注中获取属性,即.标题,但记录这一行:

I have annotations on a mapview and a callout with a button on each. What I need to do is grab properties from this callout, ie. the title, but logging this line:

NSLog(@"%@", mapView.selectedAnnotations);

返回 这显然没有给我任何有用的信息......

returns <AddressAnnotation: 0x1bdc60> which obviously gives me no useful info...

我的问题是,如何访问选定注释标注的属性?

My question is, how can I access the properties of a selected annotation callout?

推荐答案

这是我在 annotationviewClick 函数中所做的:

Here is what I did in the annotationviewClick function:

希望能帮到你

-(IBAction) annotationViewClick:(id) sender{

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


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

}

这篇关于获取有关地图视图选定注释的信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆