Rotate GMSMarker in direction at which user facing

前端 未结 8 1224
独厮守ぢ
独厮守ぢ 2020-12-28 17:58

I have requirement like on my current location one view will display. It will rotate if device was rotate or location will be change.I research lot but got all the code whic

8条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-28 18:44

    We can rotate image based on course property CLLocation Class

        let marker:GMSMarker = GMSMarker.init(position: currentLocation!)
        let head = locationManager.location?.course ?? 0
        marker.rotation = head
        marker.icon = UIImage(named: "testyCar.png")
        marker.map = mapView 
    

提交回复
热议问题