#pragma mark 向上走
- (IBAction)up
{
// 不允许直接修改 对象 的 结构体属性 的成员
// 允许直接 对象 的 结构体 属性
CGRect tempFrame = self.head.frame;
tempFrame.origin.y -= 10;
self.head.frame = tempFrame;
}
#pragma mark 放大
- (IBAction)big;
{
// 1.取出原来的属性
CGRect tempFrame = self.head.frame;
// 2.改变临时属性
tempFrame.size.width += 20;
tempFrame.size.height += 20;
// 3.用临时属性覆盖原来的属性
self.head.frame = tempFrame;
}
- (IBAction)top:(UIButton*)sender {
CGRectbtnFrame = self.headBtn.frame;
btnFrame.origin.y -= 10;
self.headBtn.frame = btnFrame;
}
self.headBtn.frame.origin.y -= 10;
开发技巧-改变按钮属性3部曲
原文:http://www.cnblogs.com/ljwios/p/5223981.html