有时,当我在设备上运行我的应用程序时,我猜大约有 20% 的时间会出现如下动画:
[tableView setEditing:NO animated:YES];
[tableView setContentOffset:rect animated:YES];
和
[viewController0 pushViewController:viewController1 animated:YES];
不要动画但立即改变。但是动画如:
[UIView animateWithDuration:0.2
animations:^{
// do something
}
completion:^(BOOL finished) {
// do something else
}];
工作正常。这发生在其他人身上吗?不确定是什么原因造成的,它只发生在这个应用程序上,从未发生在任何其他应用程序上,它只是偶尔发生。任何帮助表示赞赏。
编辑:
只是想澄清一下。
我使用“animateWithDuration”创建的动画效果很好。
有时来自 Cocoa 的动画不会在应用程序运行的整个过程中播放。
最佳答案
尝试在推送 View Controller 之前设置 UIView 动画参数。
这是一个例子:
[UIView beginAnimation:nil context:nil];
[UIView setAnimationDuration:0.5];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:viewController1.view cache:NO];
[viewController0 pushViewController:viewController1 animated:YES];
[UIView commitAnimations];
关于iphone - 非 UIView 动画 : animations not playing sometimes, UIView 动画:工作正常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12611841/