I have been playing for the past few days with MapKit and Flyover mode.
I have setup in my code the MKMapView and a corresponding MKMapCamera. For example: I have the following setup:
var mapCenter = CLLocationCoordinate2D(latitude: 40.7129,longitude: -74.0132) // World Trace Center NY
let span = MKCoordinateSpanMake(0.075, 0.075)
let region = MKCoordinateRegion(center: mapCenter, span: span)
self.map.setRegion(region, animated: true)
self.map.mapType = .SatelliteFlyover
let eyeCoordinate = CLLocationCoordinate2D(latitude: 40.712590, longitude: -74.024066) // Near WTC
self.myCamera = MKMapCamera(lookingAtCenterCoordinate: self.mapCenter, fromEyeCoordinate: eyeCoordinate,
eyeAltitude: cameraAltitude)
self.map.setCamera(self.myCamera, animated: true)So far so good, and I can properly see the maps in 3D... Now what I would like to do is to change the camera heading which is easy to do BUT my goal is not to keep the center of the map centered to its current location (World Trade Center in the example above). What I would like to do is in fact the opposite behavior of the current MKMapView behavior + MKMapCamera: in the current behavior, the map center stays always the same and the MKMapCamera is the one that is moved accordingly; what I would like is the opposite: keep the location of the MKMapCamera and have the mapCenter instead move accordingly.
Basically if I change the heading by 90 degrees (like if I was turning the camera fully to the right), I would like to have the mapCenter move accordingly... Right now it will relocate the MKMapCamera instead.
Any suggestions on how I could achieve that?