Mapkit 当前位置的纬度和经度
我想它很简单,但我不会找到它。
我想在两个文本字段中显示当前用户位置的经度和纬度。每个值一个。
但它显然行不通。
我认为使用以下值之一会很容易...但是 lon 和 lat 有很多可能性...
mapView.userLocation.coordinate.latitude
mapView.userLocation.coordinate.latitude
mapView.userLocation.location.coordinate.latitude
mapView.userLocation.location.coordinate.longitude
有谁知道我需要采用哪种组合才能简单地获得 long 和 lat 值?
预先感谢您来自德国
I imagine its pretty simple, but I wont find it.
I want to show the longitude und latitude of the current user position in two textfields. One for each value.
But it defenatly wont work.
I thought it will be easy with one of the following values... But there are so many possibilitys of lon and lat...
mapView.userLocation.coordinate.latitude
mapView.userLocation.coordinate.latitude
mapView.userLocation.location.coordinate.latitude
mapView.userLocation.location.coordinate.longitude
Does anyone know which combination I need to take to simply get the long and lat value?
Thank you in advance from germany
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果 viewDidLoad 也是初始化地图视图本身的地方,那么 userLocation 可能在 viewDidLoad 中不可用。
更好的地方是在
didUpdateUserLocation
委托方法中:还要确保:
The userLocation may not yet be available in viewDidLoad if that is also where the map view itself is being initialized.
A better place is in the
didUpdateUserLocation
delegate method:Also make sure that: