setUserTrackingMode(_:animated:)
Sets the mode to use for tracking the user’s location, with optional animation.
Declaration
func setUserTrackingMode(_ mode: MKUserTrackingMode, animated: Bool)Parameters
- mode:
The mode for tracking the user’s location. Mkusertrackingmode describes the possible values.
- animated:
If True, the map animates the change from the current mode to the new mode; otherwise, it doesn’t. This parameter affects only tracking-mode changes. Changes to the user’s location or heading use animation.
Discussion
Setting the tracking mode to MKUserTrackingMode.follow or MKUserTrackingMode.followWithHeading causes the map view to center the map on that location and begin tracking the user’s location. If it’s zoomed out, the map view automatically zooms in on the user’s location, effectively changing the current visible region.