通过编程方式关闭标记的信息窗口google maps iOS

通过编程方式关闭标记的信息窗口google maps iOS,ios,objective-c,marker,infowindow,google-maps-sdk-ios,Ios,Objective C,Marker,Infowindow,Google Maps Sdk Ios,我知道在java版本的GoogleMaps中这很容易,但我不知道如何在objective C版本的SDK中关闭信息窗口 我正在使用这种方法: -(void) mapView:(GMSMapView *)mapView didTapInfoWindowOfMarker:(id<GMSMarker>)marker { sharedGlobal.shouldShowPlayer = YES; /* adds the path to the map by deco

我知道在java版本的GoogleMaps中这很容易,但我不知道如何在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];
}
-(void)地图视图:(GMSMapView*)地图视图
didTapInfoWindowOfMarker:(id)标记{
sharedGlobal.shouldShowPlayer=是;
/*通过解码google的编码字符串将路径添加到地图*/
[自添加路径:sharedGlobal.encodedPathString];
}

并希望添加一行以关闭与marker关联的信息窗口。

我认为您可以使用以下方法:

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;
/**
*选定的标记。设置此属性将选择特定的属性
*标记,显示其上的信息窗口。如果此属性为非nil,则设置
*将其设置为nil将取消选择标记,从而隐藏信息窗口。这个物业是
*使用KVO可以观察到。
*/
@属性(非原子,强)id选择标记;
SWIFT

mapView.selectedMarker?.title = nil

回答得很好……谢谢