【问题标题】:How can I intercept touches on a marker in Google Maps SDK for iOS?如何拦截对 iOS 版 Google Maps SDK 中标记的触摸?
【发布时间】:2013-02-10 00:44:11
【问题描述】:

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

【问题讨论】:

    标签: google-maps-sdk-ios


    【解决方案1】:

    我相信您想要的是添加委托并覆盖 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;
    

    【讨论】:

    • 我认为方法已经改变了一点 - (BOOL)mapView:(GMSMapView *)mapView didTapMarker:(GMSMarker *)marker;第二个参数现在是一个指向 GMSMarker 类实例的指针。
    猜你喜欢
    • 1970-01-01
    • 2016-02-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-12-10
    • 1970-01-01
    相关资源
    最近更新 更多