gpt4 book ai didi

swift - 当缩小标记在 Swift 4 中改变位置时

转载 作者:行者123 更新时间:2023-11-30 11:03:04 26 4
gpt4 key购买 nike

我也尝试过地面覆盖,但不起作用

我没有找到任何解决方案,请帮忙。有人知道这个问题的解决办法吗?

for state in self.asset {

let state_marker = GMSMarker()

self.appTitle = state.appName
if state.appName == "AssetHistory"{
path.add(CLLocationCoordinate2D(latitude: CLLocationDegrees(state.Latitude), longitude: CLLocationDegrees(state.Longitude)))
bounds = GMSCoordinateBounds(path: path)
if self.asset.first?.Latitude as CGFloat! == state.Latitude && self.asset.first?.Longitude as CGFloat! == state.Longitude
{
state_marker.position = CLLocationCoordinate2D(latitude: CLLocationDegrees(state.Latitude), longitude: CLLocationDegrees(state.Longitude))
state_marker.icon = UIImage(named: "arrow_blue")
state_marker.title = "Start"
bounds = bounds.includingCoordinate(state_marker.position)
}
if self.asset.last?.Latitude as CGFloat! == state.Latitude && self.asset.last?.Longitude as CGFloat! == state.Longitude
{
state_marker.position = CLLocationCoordinate2D(latitude: CLLocationDegrees(state.Latitude), longitude: CLLocationDegrees(state.Longitude))
state_marker.icon = UIImage(named: "arrow_red")
state_marker.title = "End"
bounds = bounds.includingCoordinate(state_marker.position)
}
}else{
path.removeAllCoordinates()
state_marker.position = CLLocationCoordinate2D(latitude: CLLocationDegrees(state.Latitude), longitude: CLLocationDegrees(state.Longitude))
let im = UIImage(named: state.Direction)
state_marker.icon = self.imageWithImage(image: im!, scaledToSize: CGSize(width: 100.0, height: 100.0))
state_marker.title = "\(state.AssetName)"
bounds = bounds.includingCoordinate(state_marker.position)
}
state_marker.infoWindowAnchor = CGPoint(x: 0.5, y: 0.5)
state_marker.tracksViewChanges = true
state_marker.map = self.mapView
state_marker.userData = state_marker.title
}

marker are not in position

最佳答案

简单。只需在放大或缩小后重新设置state_marker的坐标即可。state_marker.position = CLLocationCooperative2D(纬度: CLLocationDegrees(state.Latitude), 经度: CLLocationDegrees(state.Longitude))

关于swift - 当缩小标记在 Swift 4 中改变位置时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53060104/

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