我在地图视图上有注释,每个都有一个带有按钮的标注。我需要做的是从这个标注中获取属性,即。标题,但记录这一行:
NSLog(@"%@", mapView.selectedAnnotations);
返回<AddressAnnotation: 0x1bdc60>
显然没有给我任何有用的信息......
我的问题是,如何访问选定注释标注的属性?
我在地图视图上有注释,每个都有一个带有按钮的标注。我需要做的是从这个标注中获取属性,即。标题,但记录这一行:
NSLog(@"%@", mapView.selectedAnnotations);
返回<AddressAnnotation: 0x1bdc60>
显然没有给我任何有用的信息......
我的问题是,如何访问选定注释标注的属性?
这是如何
for (id annotation in mapView.annotations) {NSLog([annotation title]);}
这是我在 annotationviewClick 函数中所做的:
希望这可以帮助
-(IBAction) annotationViewClick:(id) sender{
[self.view addSubview:LoadingView];
Annotation *ann = [myMap.selectedAnnotations objectAtIndex:([myMap.selectedAnnotations count]-1)];
NSLog(@"Selected:%@", [ann tag]);
}
mapView.selectedAnnotations
返回注释数组。您应该访问其项目以获取信息。