-(IBAction)bigger {
must.bounds.size = CGSizeMake(must.bounds.size.width +5.0 , must.bounds.size.height +5.0);
}
This is the code I input but I get the error saying that the expression is not assignable. Must is a uiimageview. I want to make each property (height an开发者_如何学运维d width) bigger by 5.0 each time i press the button. How can i do this.
What you probably want is to set the frame instead of the bounds. Do something like:
CGRect frame = must.frame;
frame.size.width += 5;
frame.size.height += 5;
must.frame = frame;
//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;
}
精彩评论