ios - 以编程方式关闭标记的信息窗口 google maps iOS

标签 ios objective-c marker infowindow google-maps-sdk-ios

我知道这在 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/

相关文章:

objective-c - 为什么 NSNumber 是不可变的?

iphone - 访问器/ getter 和延迟初始化

iOS:如何使用自定义信息窗口动态创建 GMSMarker?

c# - WPF DynamicDataDisplay - 使用标记缓慢绘图

python - 将文本锚定或锁定到 Matplotlib 中的标记

IOS:检测 UIView 上特定位置的滑动手势

ios - 如何使用多个 CBCharacteristicProperties 和权限初始化 CBMutableCharacteristic

ios - 恢复游戏 cocos2d

iOS 7 自定义键盘 UIView 触地事件在底行延迟

ios - 在 UITextView 中点击 NSURL