我正在为 ios 使用 GMS。我面临的问题是我无法检测到哪个标记被点击了!(自定义标记信息窗口)
你可以看到我的自定义 markerInfoWindow 代码:
在这里我正在创建标记:
-(void)CreateMarks{
for (int l=0 ; l<self.NSMuatableArray.count; l++) {
CLLocationCoordinate2D pos = CLLocationCoordinate2DMake([[[self.NSMuatableArray objectAtIndex:l] objectForKey:@"lati"] doubleValue],[[[self.NSMuatableArray objectAtIndex:l] objectForKey:@"longi"] doubleValue]);
GMSMarker *marker = [[GMSMarker alloc]init];
marker.position=pos;
marker.draggable = NO;
marker.map = mapView_;
}}
这是代表:
-(UIView*)mapView:(GMSMapView *)mapView markerInfoWindow:(GMSMarker *)marker{
CustomInfoWindow*infoW = [[[NSBundle mainBundle] loadNibNamed:@"InfoWindow" owner:self options:nil] objectAtIndex:0];
for (l=0; l<self.NSMuatableArray.count; l++) {
infoW.Title.text =[[self.NSMuatableArray objectAtIndex:l ]objectForKey:@"Title"] ;
infoW.Time.text = [[self.NSMuatableArray objectAtIndex:l ]objectForKey:@"Time"] ;
}
return infoW;
}
那么如何检测刚刚点击的对象呢?
谢谢。