Victor Krusenstråhle Victor Krusenstråhle - 8 months ago 52
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);



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