【问题标题】:Close info window of a marker programmatically google maps iOS以编程方式关闭标记的信息窗口谷歌地图 iOS
【发布时间】:2013-03-25 13:24:33
【问题描述】:
我知道在 Java 版本的 Google 地图中这很容易,但我不知道如何在 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];
}
并想添加一行来关闭与标记关联的信息窗口。
【问题讨论】:
标签:
ios
objective-c
marker
infowindow
google-maps-sdk-ios
【解决方案1】:
我认为你可以使用这个:
mapView.selectedMarker = nil;
GMSMapView.h 中 selectedMarker 属性上的 cmets 是这样说的:
/**
* 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;
【解决方案2】:
SWIFT
mapView.selectedMarker?.title = nil