CGRectOffset(frame,dx,dy)
实例
UIView *redV = [[UIView alloc] initWithFrame:CGRectMake(100, 100, 100, 100)];
redV.backgroundColor = [UIColor redColor];
[self.view addSubview:redV];
CGRect rect2 = CGRectOffset(redV.frame, -20, 20);
UIView *grrenView = [[UIView alloc]initWithFrame:rect2];
grrenView.backgroundColor = [[UIColor greenColor]colorWithAlphaComponent:0.5];
[self.view addSubview:grrenView];
//运行结果 dx或者 dy为负数的时候左移 或者上移,dx或者dy为正数的时候右移或者或者下移