Iphone 获取有关mapview选定注释的信息
我在地图视图上有注释,每个视图上都有一个带按钮的详图索引。我需要做的是从该标注中获取属性,即标题,但记录此行:Iphone 获取有关mapview选定注释的信息,iphone,annotations,mapkit,android-mapview,Iphone,Annotations,Mapkit,Android Mapview,我在地图视图上有注释,每个视图上都有一个带按钮的详图索引。我需要做的是从该标注中获取属性,即标题,但记录此行: NSLog(@"%@", mapView.selectedAnnotations); 返回,这显然没有给我任何有用的信息 我的问题是,如何访问选定注释标注的属性?mapView。selectedAnnotations返回一个注释数组。您应该访问其项目以获取信息 就是这样 for (id annotation in mapView.annotations) {NSLog([annot
NSLog(@"%@", mapView.selectedAnnotations);
返回
,这显然没有给我任何有用的信息
我的问题是,如何访问选定注释标注的属性?
mapView。selectedAnnotations
返回一个注释数组。您应该访问其项目以获取信息 就是这样
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]);
}
该代码在哪里实现?此外,这里还有一个由Bill Dudney在MapKit上制作的非常好的视频,可以从务实的程序员那里获得:它是在按下标注中的按钮时被调用的方法中实现的。我只需要抓取所选注释标题并存储它。对,我可以看到,但我需要访问有关单个注释的信息,如其标题。我使用MapView/annotations/annotations视图已经很长时间了,并且遇到了这个事实(bug?)MKMapView实例上的selectedAnnotations返回一个AnnotationView数组?!!!!你没有经历过同样(奇怪)的行为吗?没有,它似乎总是为我返回注释