Instance Method

mapRectThatFits(_:edgePadding:)

Adjusts the aspect ratio of the specified map rectangle, incorporating the specified inset values.

Declaration

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

Parameters

mapRect

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

insets

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

Return Value

A map rectangle that is still centered on the same point of the map but whose width and height are adjusted to fit in the map view’s frame minus the inset values.

See Also

Adjusting Map Regions and Rectangles

func regionThatFits(MKCoordinateRegion)

Adjusts the aspect ratio of the specified region to ensure that it fits in the map view’s frame.

func mapRectThatFits(MKMapRect)

Adjusts the aspect ratio of the specified map rectangle to ensure that it fits in the map view’s frame.