Google Maps SDK中的自定义注释视图 [英] Custom annotation view in Google Maps SDK

查看:74
本文介绍了Google Maps SDK中的自定义注释视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我基于地图创建了一个iOS应用程序,我认为该应用程序使用的是iOS版Google Maps SDK而不是Mapkit,我找到了文档,但找不到与自定义注释视图相关的方法,有人可以向我提供解决方案吗?有关如何创建自定义注释视图(信息窗口)以及如何为其添加内容(标题,摘要)的信息.

I created an iOS application based on maps in which I thought to use Google Maps SDK for iOS instead of Mapkit, I found the documentation but it I didn’t find methods related to custom annotation view, Can anyone provide me the solution for how to create custom annotation view(info window) and how to add content(title, snippet) for it.

推荐答案

如果您在GoogleMaps.Framework中检查GMSMapView.h,则可以看到以下方法,该方法应允许您为标记添加自定义信息窗口,而不是使用标准标题和摘要:

If you check GMSMapView.h within GoogleMaps.Framework, you can see the below method which should let you add a custom infowindow for a marker, instead of using standard title and snippet alone:

请注意,您(操作人员)说的是CommentationView = infoWindow
正常:annotationView =标记本身和calloutView = infoWindow

NOTE you (op) say annotationView=infoWindow
BUT NORMAL: annotationView = marker itself and calloutView = infoWindow

/**
 * Called when a marker is about to become selected, and provides an optional
 * custom info window to use for that marker if this method returns a UIView.
 * If you change this view after this method is called, those changes will not
 * necessarily be reflected in the rendered version.
 *
 * The returned UIView must not have bounds greater than 500 points on either
 * dimension.  As there is only one info window shown at any time, the returned
 * view may be reused between other info windows.
 *
 * @return The custom info window for the specified marker, or nil for default
 */
- (UIView *)mapView:(GMSMapView *)mapView
    markerInfoWindow:(id<GMSMarker>)marker;

这篇关于Google Maps SDK中的自定义注释视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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