我在Storyboard中绘制了一个UIView,它包含一些按钮,名为viewHolder。
我获得更高的职位rectForAnimationBefore
和较低位置rectForAnimationAfter
[UIView animateWithDuration:1.0
delay:0.0
options:UIViewAnimationOptionCurveEaseInOut
animations:nil completion:^(BOOL finish){
[self.viewHolder setFrame:rectForAnimationAfter];
}];
当这个被取消时,viewHolder
会向下移动。一秒钟之后,它就会出现,因为没有做任何事情。
我想moveDown,但不想自动moveUp。
因为故事板中的自动布局? 顺便问一下,如何顺利地移动它?
谢谢你们。
更新:
[UIView animateWithDuration:1.0
delay:0.0
options:UIViewAnimationOptionCurveEaseInOut
animations:^{
[self.viewHolder setFrame:rectForAnimationAfter];
}
completion:^(BOOL finish){
}];
当我更改这样的代码时,我无法将其移动。
这是我的解决方案
解锁自动布局!!!
答案 0 :(得分:1)
你的动画块首先是零。在这里你应该向下移动你的视图。完成后,您将在不使用任何动画的情况下重新设置视图。为了平滑,您需要动画地移回视图。