开发者

iPhone change height with animation, not downward sweep

I am using the code:

[UIView beginAnimations:nil context:nil];
[UIView setAnimationDelegate:self];
[UIView setAnimationDuration:0.3];
[info setFrame:CGRectMake( 0, 96, 320, 384)];
[UIView commitAnimations];

to have an animation of the object "info" to change its heght to 384... Nothing else is changed, but the only way to do that is to change the whole frame, and in the animation, instead of the height growing, the object just snaps to the top of the screen with the proper width and height, and just moves downward into place, instead of staying in place and just simply growing. How can I fix it so it does just grow downward?

EDIT: The info is a UITextView, and the downward sweep开发者_Python百科 only happens when you are not scrolled to the top.


Try this:

//... animation setup
CGRect frame = info.frame;
frame.size.height = 384;
info.frame = frame;
[UIView commitAnimations];


Instead of [info setFrame:CGRectMake( 0, 96, 320, 384)]; try info.frame.size.height = 384

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜