iPhone用动画改变高度,而不是向下扫描

时间:2010-07-14 17:57:47

标签: iphone core-animation

我正在使用代码:

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

让对象“info”的动画将其高度更改为384 ...没有其他任何内容被更改,但唯一的方法是更改​​整个帧,并在动画中,而不是高度在成长过程中,物体以适当的宽度和高度快速移动到屏幕顶部,然后向下移动到位,而不是停留在原地,只是简单地生长。我怎样才能解决这个问题呢?它会向下发展吗?

编辑:信息是UITextView,向下扫描仅在您未滚动到顶部时才会发生。

2 个答案:

答案 0 :(得分:0)

试试这个:

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

答案 1 :(得分:-2)

而不是[info setFrame:CGRectMake( 0, 96, 320, 384)];尝试info.frame.size.height = 384