Instance Property

bounds

The bounds rectangle, which describes the view’s location and size in its own coordinate system.

Declaration

var bounds: CGRect { get set }

Discussion

On the screen, the bounds rectangle represents the same visible portion of the view as its frame rectangle. By default, the origin of the bounds rectangle is set to (0, 0) but you can change this value to display different portions of the view. The size of the bounds rectangle is coupled to the size of the frame rectangle, so that changes to one affect the other. Changing the bounds size grows or shrinks the view relative to its center point. The coordinates of the bounds rectangle are always specified in points.

Changing the frame rectangle automatically redisplays the receiver without invoking the draw(_:) method. If you want the draw(_:) method invoked when the frame rectangle changes, set the contentMode property to redraw.

Changes to this property can be animated.

The default bounds origin is (0,0) and the size is the same as the frame rectangle’s size.

See Also

Configuring the Bounds and Frame Rectangles

var frame: CGRect

The frame rectangle, which describes the view’s location and size in its superview’s coordinate system.

var center: CGPoint

The center of the frame.

var transform: CGAffineTransform

Specifies the transform applied to the receiver, relative to the center of its bounds.