size of view not changing after frame change

Posted by MikeNelson on Stack Overflow See other posts from Stack Overflow or by MikeNelson
Published on 2010-04-18T21:37:58Z Indexed on 2010/04/18 21:43 UTC
Read the original article Hit count: 352

Filed under:
|
|

I have managed to do pretty complex things on iPhone but I am always stuck with views, frames, bounds, and simple stuff that defies any logic and don't work as expected.

I have a self.view in my code and it has a lot of subviews on it.

At some point of the code, I need to reduce the frame vertically to a specific size and later put it back as before.

Then I have this code:

[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:1.5];
// frame is changing to a newHeight (other parameters are the same as before)
self.view.frame = CGRectMake (0, 0, originalWidth, newHeight);
[UIView commitAnimations];

The result is simply, nothing. The view continues as before. The same size, the same position. No change.

Why this kind of thing happens? how to solve that?

© Stack Overflow or respective owner

Related posts about iphone

Related posts about iphone-sdk