我知道谷歌地图的java版本很容易,但我无法弄清楚如何在SDK的目标C版本中关闭信息窗口。
我正在使用这种方法:
-(void) mapView:(GMSMapView *)mapView
didTapInfoWindowOfMarker:(id<GMSMarker>)marker {
sharedGlobal.shouldShowPlayer = YES;
/* adds the path to the map by decoding google's encoded string */
[self addPath: sharedGlobal.encodedPathString];
}
并希望添加一行来关闭与标记关联的信息窗。
答案 0 :(得分:36)
我认为你可以使用它:
mapView.selectedMarker = nil;
GMSMapView.h中selectedMarker
属性的注释说明了这一点:
/**
* The marker that is selected. Setting this property selects a particular
* marker, showing an info window on it. If this property is non-nil, setting
* it to nil deselects the marker, hiding the info window. This property is
* observable using KVO.
*/
@property (nonatomic, strong) id<GMSMarker> selectedMarker;
答案 1 :(得分:0)
<强> SWIFT 强>
mapView.selectedMarker?.title = nil