如何拦截iOS版Google Maps SDK中标记的触摸? [英] How can I intercept touches on a marker in Google Maps SDK for iOS?

查看:82
本文介绍了如何拦截iOS版Google Maps SDK中标记的触摸?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I am new to the Google Maps SDK for iOS. When a user clicks on a marker, instead of showing the default info window with a title and snippet, I would like to direct them somewhere else in my app (such as a modal view controller). I have searched through the header files and online and I can't seem to find anything relating to touch events on markers. Does anyone have suggestions or workarounds?

推荐答案

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

I believe what you want is to add the delegate and override the didTapMarker method

/**
 * 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;

这篇关于如何拦截iOS版Google Maps SDK中标记的触摸?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆