非 UIView 动画:动画有时不播放,UIView 动画:工作正常 [英] non UIView animation: animations not playing sometimes, UIView animation: working fine

查看:43
本文介绍了非 UIView 动画:动画有时不播放,UIView 动画:工作正常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有时当我在设备上运行我的应用程序时,我猜大概有 20% 的时间,动画例如:

Sometimes when I run my app on the device, I guess about 20% of the time, animations such as:

[tableView setEditing:NO animated:YES];
[tableView setContentOffset:rect animated:YES];

[viewController0 pushViewController:viewController1 animated:YES];

不要动画,而是立即改变.但动画如:

do not animate but instantly change. But animations such as:

[UIView animateWithDuration:0.2
                     animations:^{
                         // do something
                     }
                     completion:^(BOOL finished) {
                         // do something else
                     }];

工作正常.这是否发生在其他人身上?不知道是什么原因造成的,它只发生在这个应用程序上,从来没有发生在任何其他应用程序上,而且只是偶尔发生.任何帮助表示赞赏.

Work fine. Has this happened to anybody else? Not sure what could be causing it, it only happens on this one app, never happened on any other app and it only happens sometimes. Any help appreciated.

只是想澄清一下.

我使用 'animateWithDuration' 创建的动画效果很好.

Animations that i create with 'animateWithDuration' work fine.

有时来自可可的动画不会在应用运行的整个过程中播放.

Sometimes animations from cocoa don't play for the entire time the app is running.

推荐答案

在推送视图控制器之前尝试设置 UIView 动画参数.

Try to set the UIView animation parameters before you push your viewcontroller.

这是一个例子:

[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];

这篇关于非 UIView 动画:动画有时不播放,UIView 动画:工作正常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆