//CGRectInset 将原来的矩形放大或者缩小,正表示缩小,-表示放大。CGRect rect= CGRectMake(20, 50, 100, 80); CGRect rect1=CGRectInset(rect, -10, 20); NSLog(@"%@",p(rect1));//输出结果:2014-11-22 18:48:55.351 TestCGRectInset[8893:60b] { {10, 70}, {120, 40}}
//CGRectOffset 这个函数就是将原来矩形的坐标点变化一下,就是左上角点CGRect rect= CGRectMake(20, 50, 100, 80);CGRect rect1=CGRectOffset(rect, -10, 20);NSLog(@"%@",p(rect1));//输出结果:2014-11-22 18:51:58.217 TestCGRectInset[8913:60b] { {10, 70}, {100, 80}}
//UIEdgeInsetsInsetRect 表示在原来的rect基础上根据边缘距离内切一个rect出来CGRect rect= CGRectMake(20, 50, 100, 80);UIEdgeInsets ed=UIEdgeInsetsMake(-3, -4, -5, -6);CGRect r= UIEdgeInsetsInsetRect(rect, ed);NSLog(@"%@",p(r));