如何拦截Google Maps SDK for iOS中标记的触摸?

时间:2013-02-24 22:23:33

标签: google-maps-sdk-ios

我是Google Maps SDK for iOS的新手。当用户点击标记时,我不想显示带有标题和片段的默认信息窗口,而是想将它们指向我应用中的其他位置(例如模态视图控制器)。我搜索了头文件和在线,我似乎无法找到与标记上的触摸事件有关的任何内容。有没有人有建议或解决方法?

1 个答案:

答案 0 :(得分:15)

我相信你想要的是添加委托并覆盖didTapMarker方法

/**
 * Called after a marker has been tapped.
 *
 * @param mapView The map view that was pressed.
 * @param marker The marker that was pressed.
 * @return YES if this delegate handled the tap event, which prevents the map
 *         from performing its default selection behavior, and NO if the map
 *         should continue with its default selection behavior.
 */
- (BOOL)mapView:(GMSMapView *)mapView didTapMarker:(id<GMSMarker>)marker;