gpt4 book ai didi

ios - 在iphone mkmapview中获取触摸 map 的当前位置

转载 作者:可可西里 更新时间:2023-11-01 05:00:22 27 4
gpt4 key购买 nike

如何根据用户在其 iphone 上触摸 map 上的位置来获取 mkmapview 中的位置坐标?

最佳答案

func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {

for touch in touches {
let touchPoint = touch.location(in: mapView)
let location = mapView.convert(touchPoint, toCoordinateFrom: mapView)
print ("\(location.latitude), \(location.longitude)")
}
}

关于ios - 在iphone mkmapview中获取触摸 map 的当前位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6449949/

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