簡體   English   中英

非UIView動畫:動畫有時不播放,UIView動畫:工作正常

[英]non UIView animation: animations not playing sometimes, UIView animation: working fine

有時當我在設備上運行我的應用程序時,我猜大概有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'創建的動畫效果很好。

有時,來自可可的動畫在應用程序運行的整個過程中都不會播放。

在推送viewcontroller之前嘗試設置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];

也許這是因為你使用的布爾值。 我的動畫完全相同,但工作正常:

[UIView animateWithDuration:4.0 animations:^(void) {
        [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
        pfeil.alpha = 1.00;
         }];

那是我的代碼...有什么問題嗎?

也許你的VC中有很多數據需要加載? 如果您在主線程中加載數據,它會停止所有用戶交互和UI響應一段時間。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM