Resizing a UIView - expanding the top

Posted by Mongus Pong on Stack Overflow See other posts from Stack Overflow or by Mongus Pong
Published on 2010-05-09T01:37:44Z Indexed on 2010/05/09 1:48 UTC
Read the original article Hit count: 224

Filed under:
|
|

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?

© Stack Overflow or respective owner

Related posts about cocoa-touch

Related posts about iphone