CGRectInset(frame,dx,dy);
示例如下:
UIView *redV = [[UIView alloc] initWithFrame:CGRectMake(100, 100, 100, 100)];
redV.backgroundColor = [UIColor redColor];
[self.view addSubview:redV];
CGRect rect1 = CGRectInset(redV.frame, -20, 20);
UIView *grrenView = [[UIView alloc]initWithFrame:rect1];
grrenView.backgroundColor = [[UIColor greenColor]colorWithAlphaComponent:0.5];
[self.view addSubview:grrenView];
运行结果 总结:dx 或者 dy是负数的时候是变大的 被拉伸 ,dx或者是正数的时候是缩小的 被缩小