Victor Krusenstråhle Victor Krusenstråhle - 1 year ago 83
iOS Question

How do you set the heading of the map?

I am using Mapbox, and I am trying to follow the user during the users movements thrue the map. But how do I make the camera turn in the same direction as the user does in real life?

//Create a new MKMapCamera object
let newCameraPosition = MGLMapCamera(lookingAtCenterCoordinate: mapView.centerCoordinate, fromDistance: + 65, pitch: 70, heading: 0)

// Then you could call it like this = newCameraPosition

// Track users location
self.mapView.setUserTrackingMode(MGLUserTrackingMode.Follow, animated: true);


Answer Source

You're most of the way there: use MGLUserTrackingModeFollowWithHeading (.FollowWithHeading).

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download