Cggeometry reference defines geometry and functionality for easy operation. A point cgpoint in the data structure is represented in a two-dimensional coordinate system. The location and size of the data structure CGRect represents a rectangle. The size of the data structure cgsize represents the width and height.
1. Create a geometric primitive value
Cgpoint Cgpointmake (cgpoint a,cgpoint B)
Returns a specified coordinate point
CGRect CGRectMake (cgfloat x,cgfloat y,cgfloat width,cgfloat height)
Creates a rectangle based on the specified coordinates and size
Cgsize cgsizemake (cgfloat width,cgfloat height)
Creates a cgsize based on the specified length width
2. Modify the Rectangle
CGRect Cgrectinset (cgrect rect,cgfloat dx,cgfloat dy)
Returns a rectangle larger or smaller than the original rectangle, but the center point is the same
CGRect cgrectintegral (CGRect A)
Converts the value of rectangle A to an integer to get a minimum rectangle
CGRect cgrectintersection: (CGRect a,cgrect B)
Gets the rectangle where two rectangles intersect, no intersect returns NULL, detects with Cgrectisnull
3. Compare values
BOOL Cgpointequaltopoint (cgpoint a,cgpoint B)
Returns whether two points are equal
BOOL Cgsizeequaltosize (cgsize a,cgsize B)
Cgsizeab is equal
BOOL Cgrectequaltorect (CGRect a,cgrect B)
Whether the position size of the rectangle AB is equal
BOOL Cgrectintersectsrect (CGRect a,cgrect B)
Whether the rectangle AB intersects, can be used to determine whether the Genie left the screen
4. Check
BOOL Cgrectcontainspoint (CGRect A, Cgpoint B)
Detects whether the rectangle a contains the specified point B
BOOL Cgrectcontainsrect (CGRect a,cgrect B)
Detects if rectangle A contains a rectangle b
5. Get the maximum, middle and minimum values
CGFloat Cgrectgetminx (CGRect A)
Gets the minimum value of the x-coordinate of the rectangle
CGFloat cgrectgetminy (CGRect A)
Gets the minimum value of the y-coordinate of the rectangle
CGFloat cgrectgetmidx (CGRect A)
Gets the middle value of the rectangle's X coordinate
CGFloat Cgrectgetmidy (CGRect A)
Gets the middle value of the y-coordinate of the rectangle
CGFloat Cgrectgetmaxx (CGRect A)
Gets the maximum value of the rectangle's x-coordinate
CGFloat Cgrectgetmaxy (CGRect A)
Gets the maximum value of the y-coordinate of the rectangle
6. Get high and wide
CGFloat cgrectgetheight (CGRect A)
Gets the height of the rectangle a
CGFloat cgrectgetwidth (CGRect A)
Gets the width of the rectangle a
7. Check whether the rectangle exists or infinity
BOOL Cgrectisempty (CGRect A)
Whether rectangle A is long and wide is 0, or is a null
BOOL Cgrectisnull (CGRect A)
Whether rectangle A is null
BOOL Cgrectisinfinite (CGRect A)
Whether rectangle A is infinite, no boundary
The general method of Objective-c geometry class