我的视图上有工具栏,我想用动画移动它,但动画不起作用,工具栏快速移动到新位置。我用它了:
[UIView animateWithDuration:2.0f animations:^{
[self.view layoutIfNeeded];
self.toolbarBottomLayoutConstraint.constant = editing ? 0 : -44;
}];
有人知道为什么吗?
答案 0 :(得分:1)
我试过改变动画块句子,它对我有用:
[UIView animateWithDuration:2.0 animations:^{
self.bottomMargin.constant = editing ? 0 : -44;
[self.view layoutIfNeeded];
}];
答案 1 :(得分:0)
你为什么不这样做?
[UIView animateWithDuration:2.0f
animations:^{
yourView.center = CGPointMake(yourView.frame.size.width/2, -44);
} completion:^(BOOL finished) {}];