Ios谷歌地图保持当前的位置课程(角度)总是北像谷歌导航

时间:2017-04-24 13:03:55

标签: ios google-maps rotation

我正在使用谷歌地图跟踪

func ShowcurrentMarker()
{
    currentlocationCoordinate = CLLocationCoordinate2DMake(LatestLocation.coordinate.latitude, LatestLocation.coordinate.longitude)

    if(CurrentLocationMarker == nil)
    {

        CurrentLocationMarker = GMSMarker(position:currentlocationCoordinate)
        CurrentLocationMarker.map = self.mapView
        CurrentLocationMarker.icon = UIImage.init(named:"car_icon")
        mapView.camera = GMSCameraPosition.camera(withTarget: CLLocationCoordinate2DMake(LatestLocation.coordinate.latitude, LatestLocation.coordinate.longitude), zoom: 15.0)

    }
    else
    {
        CATransaction.begin()
        CATransaction.setAnimationDuration(2)
        CurrentLocationMarker.position = currentlocationCoordinate
          CurrentLocationMarker.rotation = CLLocationDirection.abs(LatestLocation.course)
        mapView.camera = GMSCameraPosition.camera(withTarget: CLLocationCoordinate2DMake(LatestLocation.coordinate.latitude, LatestLocation.coordinate.longitude), zoom:mapView.camera.zoom)
                CATransaction.commit()

    }
}

这是我的工作代码。现在我希望我的汽车始终保持朝北的导航应用程序。

我该怎么做?

0 个答案:

没有答案