是因为在iOS上使用Google地图时,默认情况下标记的标题不会显示。要显示标记的标题,需要进行以下操作:
let marker = GMSMarker()
marker.position = CLLocationCoordinate2D(latitude: 37.785834, longitude: -122.406417)
marker.title = "San Francisco"
marker.map = mapView
func mapView(_ mapView: GMSMapView, markerInfoWindow marker: GMSMarker) -> UIView? {
let infoWindow = UIView(frame: CGRect(x: 0, y: 0, width: 200, height: 70))
infoWindow.backgroundColor = UIColor.white
let titleLabel = UILabel(frame: CGRect(x: 10, y: 10, width: 180, height: 20))
titleLabel.text = marker.title
infoWindow.addSubview(titleLabel)
return infoWindow
}
至于腾讯云的相关产品,可以考虑使用腾讯地图服务API,该API提供了丰富的地图功能和服务,可以在iOS应用中集成地图显示和标记,并且支持自定义标记的信息窗口。你可以参考腾讯云地图服务API的文档和示例来实现该功能:
腾讯云地图服务API:https://cloud.tencent.com/product/tianditu
腾讯云地图服务API文档:https://cloud.tencent.com/document/product/269
腾讯云地图服务API示例:https://github.com/TencentCloud/tencentcloud-sdk-nodejs/blob/master/examples/tiia/detectLabel.js
领取专属 10元无门槛券
手把手带您无忧上云