【发布时间】:2021-10-27 09:19:07
【问题描述】:
我正在尝试将相机移至用户位置。但是,使用
let cameraOnUser = mapView.mapboxMap.camera(for:
mapView.location.latestLocation?.coordinate, padding: .zero, bearing: nil, pitch: nil)
mapView.camera.ease(to: cameraOnUser, duration: 10.0)
不起作用,因为 mapView.location.latestLocation.coordinate 是辐射坐标,而不是精确的 CLLocationCorrdinate2D。查看 API 参考,Location.corrdinate 应该给我我需要的坐标,但是 XCode 不允许我在那个上下文中使用那个调用。计算路线适用于 latestLocation.corrdinate 但不适用于相机。
如何在新的 mapbox 版本中访问用户的位置?或者:有没有办法像我们在 v6.3.0 中一样使用 mapView.setUserTrackingMode(.follow, animates: true) 之类的东西?谢谢!我正在使用 mapboxMaps v10.0.1。
【问题讨论】:
标签: swift xcode location mapbox