-(IBAction)bigger {
must.bounds.size = CGSizeMake(must.bounds.size.width +5.0 , must.bounds.size.height +5.0);
}
这是我输入的代码,但是我得到的错误是表达式不可分配。必须是一个uiimageview。每次按下按钮,我想让每个属性(高度和宽度)增加5.0。我怎样才能做到这一点。
答案 0 :(得分:0)
您可能想要的是设置框架而不是边界。做类似的事情:
CGRect frame = must.frame;
frame.size.width += 5;
frame.size.height += 5;
must.frame = frame;
答案 1 :(得分:0)
//here u can get the image as bigger without moving its center point
-(IBAction)bigger {
CGRect _bounds = must.bounds;
CGPoint centerPoint=must.center;
_bounds.size = CGSizeMake(must.bounds.size.width + 5.0 , must.bounds.size.height + 5.0);
must.bounds = _bounds;
must.center = centerPoint;
}