MGLUserTrackingMode

enum MGLUserTrackingMode {}

The mode used to track the user location on the map. Used with MGLMapView.userTrackingMode.

See the Switch between user tracking modes example to learn how to toggle modes and how each mode behaves.

  • The map does not follow the user location.

    Declaration

    Objective-C

    MGLUserTrackingModeNone = 0

    Swift

    case none = 0
  • The map follows the user location. This tracking mode falls back to MGLUserTrackingModeNone if the user pans the map view.

    Declaration

    Objective-C

    MGLUserTrackingModeFollow

    Swift

    case follow = 1
  • The map follows the user location and rotates when the heading changes. The default user location annotation displays a fan-shaped indicator with the current heading. The heading indicator represents the direction the device is facing, which is sized according to the reported accuracy.

    This tracking mode is disabled if the user pans the map view, but remains enabled if the user zooms in. If the user rotates the map view, this tracking mode will fall back to MGLUserTrackingModeFollow.

    Declaration

    Objective-C

    MGLUserTrackingModeFollowWithHeading

    Swift

    case followWithHeading = 2
  • The map follows the user location and rotates when the course changes. Course represents the direction in which the device is traveling. The default user location annotation shows a puck-shaped indicator that rotates as the course changes.

    This tracking mode is disabled if the user pans the map view, but remains enabled if the user zooms in. If the user rotates the map view, this tracking mode will fall back to MGLUserTrackingModeFollow.

    Declaration

    Objective-C

    MGLUserTrackingModeFollowWithCourse

    Swift

    case followWithCourse = 3