Contents

mapRectThatFits(_:edgePadding:)

Returns a centered, inset map rectangle with the same aspect ratio as the map view’s frame.

Declaration

func mapRectThatFits(_ mapRect: MKMapRect, edgePadding insets: UIEdgeInsets) -> MKMapRect
func mapRectThatFits(_ mapRect: MKMapRect, edgePadding insets: NSEdgeInsets) -> MKMapRect

Parameters

  • mapRect:

    The initial map rectangle with the width and height you want to adjust.

  • insets:

    The distance (in screen points) by which to inset the returned rectangle from the actual boundaries of the map view’s frame.

Return Value

MapKit centers the map rectangle on the same point of the map, and adjusts the width and height to fit in the map view’s frame, minus its inset values.

See Also

Adjusting map regions and rectangles