1.CGRectInset
CGRect CGRectInset (
CGRect rect,
CGFloat dx,
CGFloat dy
);
return rect which is smaller or larger than the source with the same center point
CGFloat x,y,width,height,d_x,d_y;
CGRect rect = CGRectMake(x,y,width,height); //the origin frame
CGRect n_rect = CGRectInset(rect, d_x, d_y); //the new frame
n_rect.x = x + d_x;
n_rect.y = y + d_y;
n_rect.size.width = width - 2 * d_x;
n_rect.size.height = height- 2 * d_y;
offset dx,dy,adjust size by (2dx,2dy).
If the two rectangles do not intersect, returns the null rectangle.
CGRectInset vs CGRectOffset,布布扣,bubuko.com
原文地址:http://www.cnblogs.com/px-0/p/3864231.html