Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MKMapView disable rotation

Tags:

ios7

mkmapview

I have an app that uses MKMapView as a main display area. This should always be oriented north-up. But a quick inadvertent swipe and it rotates, cause the compass to appear.

Is there a way to stop this from happening and keep the view locked north? I see a few hints here, but nothing that refers to any sort of built-in mechanism.

like image 582
Maury Markowitz Avatar asked Mar 07 '14 13:03

Maury Markowitz


1 Answers

A quick look at Apple's documentation on MKMapView:

rotateEnabled A Boolean value indicating whether the map camera’s heading information is used.

@property(nonatomic, getter=isRotateEnabled) BOOL rotateEnabled Discussion When this property is set to YES and a valid camera is associated with the map, the camera’s heading angle is used to rotate the plane of the map around its center point. When this property is set to NO, the camera’s heading angle is ignored and the map is always oriented so that true north is situated at the top of the map view.

So you could try to set your mapview rotateEnabled property to ´NO´.

Apple MKMapView reference

like image 66
The dude Avatar answered Oct 04 '22 05:10

The dude