Contents

setCenter(_:animated:)

Changes the center coordinate of the map, and optionally animates the change.

Declaration

func setCenter(_ coordinate: CLLocationCoordinate2D, animated: Bool)

Parameters

  • coordinate:

    The new center coordinate for the map.

  • animated:

    Specify True if you want the map view to scroll to the new location or False if you want the map to display the new location immediately.

Discussion

Changing the center coordinate centers the map on the new coordinate without changing the current zoom level. It also updates the value in the region property to reflect the new center coordinate and the new span values needed to maintain the current zoom level.

See Also

Manipulating the visible portion of the map