Skip to content

MKMapCamera – Setting the Orientation of a MapView

Screen Shot 2014-05-15 at 3.19.42 PMUsing the MKMapCamera, you can set the orientation of a map without messing with transforms on the view or even detecting the user’s heading (though that could be helpful too).

        MKMapCamera *mapCamera = [[self.mvMap camera] copy];
        [mapCamera setHeading:headingDegrees]; 
        [self.mvMap setCamera:mapCamera animated:YES];

If you don’t want the animation, you can just set the new heading on the existing camera:

        [self.mapView.camera setHeading:heading];

There’s some other really cool calls on the MKMapCamera (reference) like heading, pitch and altitude. That combined w/ setShowsBuildings on the map can create some cool effects.

Since it was new in iOS 7, you may want to call…

[self.mvMap respondsToSelector:@selector(camera)];

…to make sure it’s safe.