CGGeometry中的方法
CGGeometry中的方法
Creating a Geometric Primitive from Values//创建几何单元(点,尺寸,位置和尺寸)
CGPointMake
CGPoint CGPointMake (
?? CGFloat x,
?? CGFloat y
);
CGRectMake
CGRect CGRectMake (
?? CGFloat x,
?? CGFloat y,
?? CGFloat width,
?? CGFloat height
);
CGSizeMake
CGSize CGSizeMake (
?? CGFloat width,
?? CGFloat height
);
Modifying Rectangles//编辑矩形
CGRectDivide
Divides a source rectangle into two component rectangles.
//把一个源矩形分成两部分
void CGRectDivide (
?? CGRect rect,
?? CGRect *slice,
?? CGRect *remainder,
?? CGFloat amount,
?? CGRectEdge edge
);
CGRectInset
Returns a rectangle that is smaller or larger than the source rectangle, with the same center point.
//返回的矩形和原来的矩形相同的中心,但是长和宽改变了
CGRect CGRectInset (
?? CGRect rect,
?? CGFloat dx,
?? CGFloat dy
);
CGRectIntegral
Returns the smallest rectangle that results from converting the source rectangle values to integers.
//返回成整数的矩形
CGRect CGRectIntegral (
?? CGRect rect
);
CGRectIntersection
Returns the intersection of two rectangles.
//返回两个矩形的重叠部分
CGRect CGRectIntersection (
?? CGRect r1,
?? CGRect r2
);
CGRectOffset
Returns a rectangle with an origin that is offset from that of the source rectangle.
//返回的矩形原点和原来的矩形是一样的,然后长和宽发生了变化
CGRect CGRectOffset (
?? CGRect rect,
?? CGFloat dx,
?? CGFloat dy
);
CGRectStandardize
Returns a rectangle with a positive width and height.
//把矩形标准话,也就是说返回的矩形的长和宽是正值
CGRect CGRectStandardize (
?? CGRect rect
);
CGRectUnion
Returns the smallest rectangle that contains the two source rectangles.
//返回的矩形是包含了两个矩形的最小矩形
CGRect CGRectUnion (
?? CGRect r1,
?? CGRect r2
);
Comparing Values
//比较各种值
CGPointEqualToPoint//判断两个点是否相等
CGSizeEqualToSize
CGRectEqualToRect
CGRectIntersectsRect//判定两个矩形是否相交
bool CGRectIntersectsRect (
?? CGRect rect1,
?? CGRect rect2
);
Checking for Membership//判断拥有关系
CGRectContainsPoint
CGRectContainsRect
Getting Min, Mid, and Max Values//得到最大最小值
CGRectGetMinX
CGRectGetMinY
CGRectGetMidX
CGRectGetMidY
CGRectGetMaxX
CGRectGetMaxY
Getting Height and Width//得到高和宽
CGRectGetHeight
CGRectGetWidth
Checking Rectangle Characteristics//检查矩形的特性
CGRectIsEmpty//检查是否为空
Returns whether a rectangle has zero width or height, or is a null rectangle.
CGRectIsNull//检查是否为Null
Returns whether the rectangle is equal to the null rectangle.
CGRectIsInfinite//检查是否为无边
Returns whether a rectangle is infinite.