Reputation: 17834
When you resize a UIView, the width/height increases to the right/bottom direction. Is there a way to make it go the opposite directions? I thought this might be something layer.anchorPoint
can achieve, but it doesn't look like it.
Upvotes: 2
Views: 1483
Reputation: 22478
The fastest way to do it would be to remake the view's frame.
Say you want to increase it's width and height by 10 in the "opposite" direction.
This would do that.
view.frame = CGRectMake(view.frame.origin.x - 10, view.frame.origin.y - 10, view.frame.size.width + 10, view.frame.size.height + 10);
You might put this in a method to make it easier:
-(void)inverseResizeView(UIView *)view width:(int)deltaWidth height:(int)deltaHeight{
view.frame = CGRectMake(view.frame.origin.x - deltaWidth, view.frame.origin.y - deltaHeight, view.frame.size.width + deltaWidth, view.frame.size.height + deltaHeight);
}
Upvotes: 2