Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I cancel the CATransaction completionBlock?

In a CATransaction I have the following code:

[CATransaction setCompletionBlock:^{
    ...do something ....
}];

The animation runs for about half a second. I want to be able to cancel the completion block if some other events happen in the class logic...

Is there a way to prevent this block to run after the animation has started?

like image 218
zumzum Avatar asked May 23 '14 19:05

zumzum


1 Answers

Try to add some logic that will check state of other events. Somthing like this:

[CATransaction setCompletionBlock:^{
    if(some other events happen){
       return;
    }
}];
like image 70
Alexey Kubas Avatar answered Sep 28 '22 04:09

Alexey Kubas