4

With the following code it is possible to setup a button for toggling the setUserTrackingMode in a navigation bar.

// set MKUserTrackingBarButton
// source: http://stackoverflow.com/questions/9876157/is-the-current-location-compass-  heading-button-available-in-the-ios-sdk

MKUserTrackingBarButtonItem *buttonItem = [[MKUserTrackingBarButtonItem alloc]   initWithMapView:self.mapView];
self.navigationItem.rightBarButtonItem = buttonItem;

// set tracking mode
[self.mapView setShowsUserLocation:YES];
[self.mapView setUserTrackingMode:MKUserTrackingModeFollowWithHeading animated:YES];

How to do this the way (button lower left corner within map) Apple does this in Maps? (Sorry, I'm not allowed to post a picture clarifying it)

Ortwin Gentz
  • 52,648
  • 24
  • 135
  • 213
Heavy
  • 113
  • 1
  • 7
  • Is that question so far from beeing relevant for others or is the answer more trivial than I realize? Please give the question a vote. – Heavy Nov 07 '12 at 19:44

1 Answers1

0

You can add a MKUserTrackingBarButton to a UIToolbar which is positioned at the bottom of the screen (and potentially has a custom background). That should allow reproducing the Maps.app behavior.

Ortwin Gentz
  • 52,648
  • 24
  • 135
  • 213