UIView动画曲线不适用于某些动画

时间:2016-04-13 06:27:31

标签: ios objective-c animation uiview

我有一个应用程序,其中我使用很多动画和轻松的输入/输出曲线。我在所有情况下都使用此功能:[UIView animateWithDuration:2 delay:0 options:UIViewAnimationOptionCurveEaseOut animations:^{ self.activityBar.view.frame = CGRectMake(0, self.activityBar.view.frame.origin.y, self.activityBar.view.frame.size.width, 20); } completion:nil];

所有这些动画都运行正常,但现在我正在尝试将一个动画添加到弹出的抽屉中,并且由于某种原因,这个特定的动画始终是线性的:

self.activityBar.view

为什么这个动画是线性的,而其他具有相同选项的动画是弯曲的?

这是-UIViewController -UIViewController -UIViewController (animation code lives here) -UIViewController (activityBar) -UIView (activityBar.view)

的视图层次结构
.d.ts

1 个答案:

答案 0 :(得分:0)

//Set old Frame for activityBar Here

[UIView animateWithDuration:2.0 delay:0.0 options:UIViewAnimationOptionCurveEaseOut animations:^{
        [self.view layoutIfNeeded];
//Update to the new frame 
self.activityBar.view.frame = CGRectMake(0, self.activityBar.view.frame.origin.y, self.activityBar.view.frame.size.width, 20);

    } completion:^(BOOL finished) {

    }];