gpt4 book ai didi

swift - 如何在 swift4 中显示 GMSPolygon 的标题

转载 作者:搜寻专家 更新时间:2023-11-01 05:31:57 25 4
gpt4 key购买 nike

这是我的代码,它显示多边形但标题没有显示在任何地方。

       func showGeofense(zoomeffectTo:Int)  {
for item in self.Geofenses
{
let polygon = GMSPolygon()
let path = GMSMutablePath()
var cord = CLLocationCoordinate2D(latitude: item.coordinatesArray[0].lat, longitude: item.coordinatesArray[0].lng)
for o in item.coordinatesArray
{
path.add(CLLocationCoordinate2D(latitude: o.lat, longitude: o.lng))
}

polygon.path = path
// polygon.fillColor = #colorLiteral(red: 0.9474907517, green: 0.2350950539, blue: 0.1785519123, alpha: 0.24)
var color = item.polygonColor
color.remove(at: color.startIndex)
print(color)
var col:Int = Int(color) ?? 0xFFFFFF
polygon.isTappable = true
polygon.strokeColor = UIColor(hex: col).withAlphaComponent(0.3)
polygon.strokeWidth = 5
polygon.title = item.name
polygon.map = googlemapView

if zoomeffectTo == 3
{
self.moveCameraTo(pos: cord)
}
}
}
// this is printing the title when i click on ploygon
func mapView(_ mapView: GMSMapView, didTap overlay: GMSOverlay) {
print(overlay.title)

}

上面的函数 didtap overlay 正在触发并打印标题,但我找不到任何方法来显示地理围栏的标题或描述。

最佳答案

检查 GoogleMaps.framework -> GMSPolygon 我发现它的父对象是 GMSOverlay。

在title的描述上我可以看到:

/**
* Title, a short description of the overlay. Some overlays, such as markers, will display the title
* on the map. The title is also the default accessibility text.
*/
@property(nonatomic, copy, nullable) NSString *title;

好像只有标记会显示标题...

关于swift - 如何在 swift4 中显示 GMSPolygon 的标题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56853961/

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