[英]Close info window of a marker programmatically google maps iOS
I know it's easy in the java version of Google Maps but I can't figure out how to get the info window to close in the objective C version of the SDK. 我知道谷歌地图的java版本很容易,但我无法弄清楚如何在SDK的目标C版本中关闭信息窗口。
I'm using this method: 我正在使用这种方法:
-(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];
}
And want to add a line to close the infowindow associated with marker. 并希望添加一行来关闭与标记相关的信息窗口。
I think you can use this: 我想你可以用这个:
mapView.selectedMarker = nil;
The comments on the selectedMarker
property in GMSMapView.h say this: 对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;
迅速
mapView.selectedMarker?.title = nil
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.