Resizing a UIView - expanding the top
- by Mongus Pong
I have a UIView inside of a UIScrollView that I want to resize.
I can increase the height easily by :
CGRect frame = self.drawinView.frame;
frame.size.height += 100;
self.drawinView.frame = frame;
self.drawinScrollView.contentSize = CGSizeMake(frame.size.width, frame.size.height);
And all is good.
The above code will create a new area of the view at the bottom of the view that I can fill out.
Now when I resize the view, I only want to be repainting the new portion of the view that has just been created. I dont want to have to repaint the whole view.
However! I have run into difficulty when I need to expand the top of the view.
Doing :
CGRect frame = self.drawinView.frame;
frame.origin.y -= 100;
self.drawinView.frame = frame;
self.drawinScrollView.contentSize = CGSizeMake(500, 600);
does not work.
How can I do this without having to repaint the entire view?