5

I have placed an MKMapView on my .xib.
It works fine, but I need the map to rotate according to the compass heading?

I have read about "compass mode".
Perhaps I need to set the MKMapView property of compassMode to be true. But I can not find any check box for such an option in the properties of the MKMapView.

So how do I enable compass mode for my mapview?
Is there no check box for turning this on.
Btw,. I even watched the 46 minute video at developer.apple.com

"Visualizing information geographically with MapKit".
This video demonstrated an app that worked in such a compass mode. But I never saw any explanation of how to make it work like that. Any suggestions would be great. -jd

David Ansermot
  • 6,052
  • 8
  • 47
  • 82
John Dorsey
  • 157
  • 1
  • 11

1 Answers1

12
[mapView setUserTrackingMode:MKUserTrackingModeFollowWithHeading];
Craig
  • 8,093
  • 8
  • 42
  • 74
  • Exactly the help i needed. Thanks very much! – John Dorsey Mar 15 '13 at 18:56
  • Glad to hear it. If it does what you need you should now mark this question as answered. – Craig Mar 15 '13 at 19:32
  • As far I used that method is very bugged if I try to zoom or move it, it also can crash your app, tell me if I'm wrong. – Alejandro L. Mar 25 '13 at 10:24
  • You're wrong. That method is rock solid, if your app crashes it isn't because of that method. Take out that line and see. Also, it is designed to snap you out of compass mode when you pan around the map. – Craig Mar 25 '13 at 17:43