Function

CGRectContainsPoint

Returns whether a rectangle contains a specified point.

Declaration

bool CGRectContainsPoint(CGRect rect, CGPoint point);

Parameters

rect

The rectangle to examine.

point

The point to examine.

Return Value

YES if the rectangle is not null or empty and the point is located within the rectangle; otherwise, NO.

Discussion

A point is considered inside the rectangle if its coordinates lie inside the rectangle or on the minimum X or minimum Y edge.

See Also

Checking for Membership

CGRectContainsRect

Returns whether the first rectangle contains the second rectangle.

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