Function

CGRectUnion

Returns the smallest rectangle that contains the two source rectangles.

Declaration

CGRect CGRectUnion(CGRect r1, CGRect r2);

Parameters

r1

The first source rectangle.

r2

The second source rectangle.

Return Value

The smallest rectangle that completely contains both of the source rectangles.

Discussion

Both rectangles are standardized prior to calculating the union. If either of the rectangles is a null rectangle, a copy of the other rectangle is returned (resulting in a null rectangle if both rectangles are null). Otherwise a rectangle that completely contains the source rectangles is returned.

See Also

Modifying Rectangles

CGRectDivide

Divides a source rectangle into two component rectangles.

CGRectInset

Returns a rectangle that is smaller or larger than the source rectangle, with the same center point.

CGRectIntegral

Returns the smallest rectangle that results from converting the source rectangle values to integers.

CGRectIntersection

Returns the intersection of two rectangles.

CGRectOffset

Returns a rectangle with an origin that is offset from that of the source rectangle.

CGRectStandardize

Returns a rectangle with a positive width and height.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software