我知道这在 Java 版本的 Google map 中很容易,但我不知道如何在 Objective-C 版本的 SDK 中关闭信息窗口。
我正在使用这种方法:
-(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];
}
并想添加一行来关闭与标记关联的信息窗口。
最佳答案
我想你可以用这个:
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;
关于ios - 以编程方式关闭标记的信息窗口 google maps iOS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15794797/