[英]Bearing of Current location in iOS SDK
I have just completed an Android app, where I used bearing value of current location. 我刚刚完成了一个Android应用程序,其中我使用了当前位置的方位值。 Now I am trying to do same app for iOS.
现在我正在尝试为iOS做同样的应用程序。 But did not find a way to get bearing of current location in iOS sdk?
但是没有办法在iOS sdk中获取当前位置?
I am not looking how to calculate bearing between two CLLocationCoordinate2Ds ( Calculating bearing between two CLLocationCoordinate2Ds ). 我不知道如何计算两个CLLocationCoordinate2D 之间的方位 ( 计算两个CLLocationCoordinate2D之间的方位 )。
*** I need bearing of current location. ***我需要承担当前位置。
Any help will be great for me. 任何帮助对我来说都很棒。
CLLocation
has a course
property (type CLLocationDirection
) which is the bearing. CLLocation
有一个course
属性(类型CLLocationDirection
),它是方位。 From the docs: 来自文档:
Course values are measured in degrees starting at due north and continuing clockwise around the compass.
课程值以从正北方向开始并以指南针顺时针方向继续测量。 Thus, north is 0 degrees, east is 90 degrees, south is 180 degrees, and so on.
因此,北是0度,东是90度,南是180度,依此类推。 Course values may not be available on all devices.
课程值可能并非在所有设备上都可用。 A negative value indicates that the direction is invalid.
负值表示方向无效。
I know that this question is old but I will leave my answer that may help other people who pass by here. 我知道这个问题已经过时但我会留下我的答案,这可能有助于其他人经过这里。
class MapViewController: GMSMapViewDelegate {
func mapView(_ mapView: GMSMapView, idleAt position: GMSCameraPosition) {
self.bearing = position.bearing
}
}
Using this delegate you can obtain the bearing related with camera rotation from the google maps SDK. 使用此代理,您可以从google maps SDK获取与相机旋转相关的方位。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.