【发布时间】:2010-03-17 06:42:24
【问题描述】:
我想将 UIView “拉伸”到右侧,这意味着使用 [UIView beginAnimations] 将其 frame.size.width 增加 foo 像素,同时将其 frame.origin.x 减少 foo 像素句法。 但是,如果我这样做,当动画开始时,视图会立即调整大小,然后为原点启动动画。
CGRect currFrame = someView.frame;
currFrame.size.width += 100;
currFrame.origin.x -= 100;
[UIView beginAnimations:@"Anim1" context:nil];
someView.frame = currFrame;
[UIView setAnimationDuration:0.7];
[UIView commitAnimations];
我也尝试将动画分成两部分,但我无法保持正确的位置。
非常感谢任何帮助!
【问题讨论】:
-
您找到解决方案了吗?我也遇到了同样的问题,但很奇怪,为什么视图会立即调整大小然后开始动画?
标签: iphone cocoa-touch uiview core-animation