2

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

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

返回<AddressAnnotation: 0x1bdc60>显然没有给我任何有用的信息......

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

4

3 回答 3

2

这是如何

 for (id annotation in mapView.annotations) {NSLog([annotation title]);}
于 2011-02-25T16:28:05.933 回答
2

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

希望这可以帮助

-(IBAction) annotationViewClick:(id) sender{

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


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

}
于 2011-03-15T23:24:18.460 回答
1

mapView.selectedAnnotations返回注释数组。您应该访问其项目以获取信息。

于 2009-11-19T11:44:23.727 回答