Instance Property


The rectangle that defines the stretchable and nonstretchable regions of a view.


@property(nonatomic) CGRect contentStretch;


You use this property to control how a view’s content is stretched to fill its bounds when the view is resized. Content stretching is often used to animate the resizing of a view. For example, buttons and other controls use stretching to maintain crisp borders while allowing the middle portions of the control to stretch and fill the available space.

The values you specify for this rectangle must be normalized to the range 0.0 to 1.0. These values are then scaled to the size of the view’s content to obtain the appropriate pixel values. The default value for this rectangle has an origin of (0.0, 0.0) and a size of (1.0, 1.0). This reflects a rectangle whose stretchable portion encompasses the entire content.

See Also

Configuring the Resizing Behavior


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


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

- sizeThatFits:

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

- sizeToFit

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


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


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