2013-02-24 76 views
5

我不熟悉適用於iOS的Google Maps SDK。當用戶點擊一個標記,而不是顯示帶有標題和片段的默認信息窗口時,我想將它們引導到我的應用程序中的其他位置(例如模式視圖控制器)。我已經搜索了頭文件和在線,並且我似乎無法找到與標記上的觸摸事件相關的任何內容。有沒有人有建議或解決方法?如何攔截Google Maps SDK for iOS中的標記觸摸?

回答

14

我相信你想要的是添加的委託,並覆蓋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; 
+0

我認爲該方法已經改變了一點 - (BOOL)MapView類:(GMSMapView中*)的MapView didTapMarker:(GMSMarker *)標記; 現在第二個參數是一個指向GMSMarker類實例的指針。 – 2015-01-30 10:14:42