Par*_*rda 6 google-maps dictionary google-maps-markers ios swift
我正在做一个项目,将标记添加到Google地图上,但我想添加Xib的自定义标记,就像我想将自定义视图添加到地图上,而不是Google地图的marker.icon默认值一样
我做了一个uiview,我将从中下载图像,然后将UIView放置在地图上
对于自定义视图作为标记物时,你可以使用iconView的GMSMarker。
- (UIView*) iconView
Run Code Online (Sandbox Code Playgroud)
要渲染的标记视图。如果保留为 nil,则回退到 icon 属性。支持 UIView 的所有动画属性的动画,除了 frame 和 center。不支持更改这些属性或其相应的 CALayer 版本,包括位置。请注意,视图的行为就像 clipsToBounds 设置为 YES,无论其实际值如何。
更多请参考: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
Run Code Online (Sandbox Code Playgroud)