以编程方式谷歌地图iOS的标记的关闭信息窗口

CSS*_*ent 15 objective-c infowindow marker ios google-maps-sdk-ios

我知道谷歌地图的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];
}
Run Code Online (Sandbox Code Playgroud)

并希望添加一行来关闭与标记相关的信息窗口.

Sax*_*uce 38

我想你可以用这个:

mapView.selectedMarker = nil;
Run Code Online (Sandbox Code Playgroud)

selectedMarkerGMSMapView.h中对属性的注释说明:

/**
 * 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;
Run Code Online (Sandbox Code Playgroud)