Structure

UIEdgeInsets

The inset distances for views.

Declaration

struct UIEdgeInsets

Overview

Edge inset values are applied to a rectangle to shrink or expand the area represented by that rectangle. Typically, edge insets are used during view layout to modify the view’s frame. Positive values cause the frame to be inset (or shrunk) by the specified amount. Negative values cause the frame to be outset (or expanded) by the specified amount.

See also init(top:left:bottom:right:) and zero.

Topics

Creating Edge Insets

init()

Initializes the edge inset struct to default values.

Getting the Edge Values

var bottom: CGFloat

The bottom edge inset value.

var left: CGFloat

The left edge inset value.

var right: CGFloat

The right edge inset value.

var top: CGFloat

The top edge inset value.

Comparing Edge Insets

func UIEdgeInsetsEqualToEdgeInsets(UIEdgeInsets, UIEdgeInsets) -> Bool

Returns a Boolean value indicating whether the two edge insets are the same.

Deprecated

Managing Edge Insets

func inset(by: UIEdgeInsets) -> CGRect

Adjusts a rectangle by the given edge insets.

Converting To and From Strings

class func string(for: UIEdgeInsets) -> String

Returns a string formatted to contain the data from an edge insets structure.

class func uiEdgeInsets(for: String) -> UIEdgeInsets

Returns a UIKit edge insets structure based on the data in the specified string.

Getting the Empty Edge Insets

static let zero: UIEdgeInsets

An edge insets struct whose top, left, bottom, and right fields are all set to 0.

Instance Methods

Relationships

See Also

Related Types

struct UIOffset

Defines a structure that specifies an amount to offset a position.

struct NSDirectionalEdgeInsets

Edge insets that take language direction into account.