Enumeration

UIViewContentMode

Options to specify how a view adjusts its content when its size changes.

Topics

Constants

case scaleToFill

The option to scale the content to fit the size of itself by changing the aspect ratio of the content if necessary.

case scaleAspectFit

The option to scale the content to fit the size of the view by maintaining the aspect ratio. Any remaining area of the view’s bounds is transparent.

case scaleAspectFill

The option to scale the content to fill the size of the view. Some portion of the content may be clipped to fill the view’s bounds.

case redraw

The option to redisplay the view when the bounds change by invoking the setNeedsDisplay() method.

case center

The option to center the content in the view’s bounds, keeping the proportions the same.

case top

The option to center the content aligned at the top in the view’s bounds.

case bottom

The option to center the content aligned at the bottom in the view’s bounds.

case left

The option to align the content on the left of the view.

case right

The option to align the content on the right of the view.

case topLeft

The option to align the content in the top-left corner of the view.

case topRight

The option to align the content in the top-right corner of the view.

case bottomLeft

The option to align the content in the bottom-left corner of the view.

case bottomRight

The option to align the content in the bottom-right corner of the view.

See Also

Configuring the Resizing Behavior

var contentMode: UIViewContentMode

A flag used to determine how a view lays out its content when its bounds change.

func sizeThatFits(CGSize)

Asks the view to calculate and return the size that best fits the specified size.

func sizeToFit()

Resizes and moves the receiver view so it just encloses its subviews.

var autoresizesSubviews: Bool

A Boolean value that determines whether the receiver automatically resizes its subviews when its bounds change.

var autoresizingMask: UIViewAutoresizing

An integer bit mask that determines how the receiver resizes itself when its superview’s bounds change.