码迷,mamicode.com
首页 > 其他好文 > 详细

CGRectInset vs CGRectOffset

时间:2014-07-24 05:05:48      阅读:264      评论:0      收藏:0      [点我收藏+]

标签:width   re   c   cti   ar   new   

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

CGRectInset vs CGRectOffset

标签:width   re   c   cti   ar   new   

原文地址:http://www.cnblogs.com/px-0/p/3864231.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!