如何在 ios 上向谷歌地图标记信息窗口添加按钮? [英] How can i add a button to google maps marker info window on ios?

查看:26
本文介绍了如何在 ios 上向谷歌地图标记信息窗口添加按钮?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已将适用于 ios 的 Google 地图 sdk 添加到我的 Iphone 应用程序中,如果单击的信息窗口弹出带有标题的信息,我有一些自定义标记,我如何向此信息窗口添加按钮,以便如果按下将转到新页面?现在我尝试使用这篇文章来解决这个问题 在适用于本机 iOS/objective C 的 Google Maps SDK 中的 InfoWindow/Marker 上添加点击事件它不会给我错误,但它不起作用.

I have added Google maps sdk for ios to my Iphone app, and i have some custom markers if clicked info window pops up with title, how can i add a button to this info window so if pressed will go to new page? Now i have tryed to use this post to solve this issue Adding Click Event on InfoWindow/Marker in Google Maps SDK for native iOS/objective C it doesnt give me error but it won't work.

这就是我想要的结果:http://www.flickr.com/photos/74719051@N05/6728157477/

推荐答案

您链接的问题的答案显示了使用 MapKit 的代码,因此它不适用于 iOS 版 Google Maps SDK.

The answer for the question you linked shows code for using MapKit, so it wouldn't work with the Google Maps SDK for iOS.

有关如何使用适用于 iOS 的 Google Maps SDK 返回自定义视图的问题,请参阅此问题:

See this question for how to return a custom view with the Google Maps SDK for iOS:

Google Maps SDK 中的自定义注释视图

但是请注意,根据this question,看起来显示的内容可能是视图的视觉副本,而不是实际视图,这可能会限制您可以与视图进行的交互:

However note that according to this question, it looks like what is displayed might be a visual copy of the view not the actual view, which might limit the interaction you can do with the view:

添加按钮以查看由markerInfoWindow委托方法返回的视图

不过,使用 didTapWindowOfMarker 应该可以简单地检测信息窗口上的点击并转到不同的页面.

Simply detecting a tap on the info window and going to a different page should be possible using didTapWindowOfMarker though.

请注意,Google 的问题跟踪器中有一项功能请求可以为此添加直接支持:

Note that there's a feature request in Google's issue tracker to add direct support for this:

https://code.google.com/p/gmaps-api-issues/issues/detail?id=4961

这篇关于如何在 ios 上向谷歌地图标记信息窗口添加按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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