我们可以在 Swift 中显示一些动态文本以及 Google 地图上的标记吗?
我正在尝试在标记下添加一些文本,如下图所示,我正在使用谷歌地图,Swift
我想在标记下添加一些文本。有办法做到这一点吗?
我的代码
self.mapView.clear();
var bounds = GMSCoordinateBounds();
if let lat = alert?.latitude, let lon = alert?.longitude{
let position = CLLocationCoordinate2D(latitude: lat, longitude: lon)
let marker = GMSMarker(position: position);
marker.title = alert?.deviceName;
marker.groundAnchor = CGPoint(x: 0.5, y: 0.5);
marker.map = mapView;
bounds = bounds.includingCoordinate(position);
}
let update = GMSCameraUpdate.fit(bounds)
self.mapView.animate(with: update);
I'm trying to add some text under marker like in the picture mentioned below,I'm using google maps, Swift
I want to add some text under my marker. There is a way to do that?
My Code
self.mapView.clear();
var bounds = GMSCoordinateBounds();
if let lat = alert?.latitude, let lon = alert?.longitude{
let position = CLLocationCoordinate2D(latitude: lat, longitude: lon)
let marker = GMSMarker(position: position);
marker.title = alert?.deviceName;
marker.groundAnchor = CGPoint(x: 0.5, y: 0.5);
marker.map = mapView;
bounds = bounds.includingCoordinate(position);
}
let update = GMSCameraUpdate.fit(bounds)
self.mapView.animate(with: update);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用 Maps SDK for iOS 实用程序库自定义标记。请参阅 CustomerMarkerViewController 作为示例。
You can use the Maps SDK for iOS Utility Library to customize the marker. See CustomerMarkerViewController as an example.