如何将 Xib 作为标记而不是 google 地图标记图标放置在 google 地图上

How to place Xib on google map as Marker instead of google map marker icon

我正在做一个项目,我要在 google 地图上添加标记,但我想添加 Xib 的自定义标记,就像我想在地图上添加自定义视图而不是 marker.icon默认为google映射

我制作了一个 uiview,我将从中下载图像,然后想将该 UIView 放置在地图上

对于作为标记的自定义视图,您可以使用 GMSMarkericonView

- (UIView*) iconView

Marker view to render. If left nil, falls back to the icon property instead. Supports animation of all animatable properties of UIView, except frame and center. Changing these properties or their corresponding CALayer version, including position, is not supported. Note that the view behaves as if clipsToBounds is set to YES, regardless of its actual value.

更多请参考:https://developers.google.com/maps/documentation/ios-sdk/reference/interface_g_m_s_marker.html#aa16a89bd5187e64e71c57c31c150a44d

只需将自定义视图设置为标记的 iconView

 let marker = GMSMarker()
 marker.iconView = UIView() //Your custom view here