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.
2
votes
1 Answers
2
votes
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);
}
position:absolute; bottom:0; right:0;
. If you resize this element, it goes in the left/top direction. – pixelfreakresize
method are you using? Adjusting the frame is the main way I resize things therefore this idea of a view resizing bottom/right is dependant on the caller setting the frame to have that happen. – Paul.s