我正在尝试制作一个有 3 个按钮的简单应用程序。当用户点击任何按钮时,他们会被动画(移动)到他们的新位置!所有这一切都来自这段代码:
[UIView animateWithDuration:1.2
delay:0.1
options: UIViewAnimationCurveEaseOut
animations:^
{
//Moving the Sum (UIButton which will move through this animation)
CGRect frame = Sum.frame;
frame.origin.y = -20;
frame.origin.x = (-120);
Sum.frame = frame;
.....
....
}
completion:^(BOOL finished)
{
NSLog(@"Completed");
//adding subview after the animation is complete! newView is an example!
[self.view addSubview:newView];}];
问题是,一旦我将子视图添加到主视图,所有按钮都会回到原来的位置!意味着他们没有被永久移动..我该如何解决这个问题?请帮助伙计们!