Is it possible to have an embedded MKMapView
rotate to always face the direction the iPhone is facing? Basically I want to mimic the Map app rotation feature o
Simple solution in swift 3.0. Make sure to put the line in mapViewDidFinishLoadingMap
or it will ignore it
public func mapViewDidFinishLoadingMap(_ mapView: MKMapView)
{
mapView.setUserTrackingMode(.followWithHeading, animated: false)
}
If you don't want the map to center on the user location you might do something like this
public func locationManager(_ manager: CLLocationManager, didUpdateHeading newHeading: CLHeading)
{
if(CLLocationCoordinate2DIsValid(mapView.centerCoordinate))
{
mapView.camera.heading = newHeading.trueHeading
}
}