首页 > 代码库 > CGRectInset vs CGRectOffset
CGRectInset vs CGRectOffset
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.
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。