gpt4 book ai didi

IOS Swift Google map 截断标题

转载 作者:行者123 更新时间:2023-11-30 11:43:05 25 4
gpt4 key购买 nike

我使用下面的代码将带有标题的标记添加到 map 中。

func showAllMarker(){
loadLocatons(){
completion in
if completion {
super.hideLoading()
self.mapView.clear()
self.circle(withRadius: self.Defradius, circleCenter: self.myLocation2D)
for point in self.mobLocationData {

if point.status == ConstantValues.activeStatus{
let marker = GMSMarker()
let latitude = point.latitude
let longitude = point.longitude
let position = CLLocationCoordinate2D(latitude: NSString(string: latitude!).doubleValue, longitude: NSString(string: longitude!).doubleValue)

marker.position = position
marker.title = point.description

marker.userData = LocationMarkerData(id: point.id!, address: point.address!)
marker.map = self.mapView
}
}
DispatchQueue.main.asyncAfter(deadline: .now() + 0.2, execute: {
let camera = GMSCameraPosition.camera(withLatitude: self.myLocation.coordinate.latitude, longitude: self.myLocation.coordinate.longitude, zoom: 10.5,bearing: 350,viewingAngle: 10)
CATransaction.begin()
CATransaction.setValue(1.5, forKey: kCATransactionAnimationDuration)
self.mapView.animate(to: camera)
CATransaction.commit()

})
}
}
}

有时点击标记时不会显示完整标题。它截断了标题。见下图。

enter image description here在谷歌地图文档中,它说只有很长的消息可能会被截断。

Strings that are longer than the width of the info window are automatically wrapped over several lines. Very long messages may be truncated.

但是图像中上述标记的标题是“test”。所以这不是一个很长的标题。还有一些其他标记的标题比这更长,并且它们不会被截断。见下图

enter image description here

那么有人可以解释一下我做错了什么以及如何纠正这个问题吗?

最佳答案

只需将单词的第一个字母大写,如下所示:

let outlet_name = "\(DataDict["routeName"] ?? "")".lowercased()
marker.title = outlet_name.capitalizingFirstLetter()

这对我来说神奇地有效。

关于IOS Swift Google map 截断标题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49123654/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com