Re: CATransaction setCompletionBlock - Nested Transactions bug?
Re: CATransaction setCompletionBlock - Nested Transactions bug?
- Subject: Re: CATransaction setCompletionBlock - Nested Transactions bug?
- From: Seth Willits <email@hidden>
- Date: Mon, 8 Nov 2010 20:33:10 -0800
On Nov 8, 2010, at 8:32 AM, Kyle Sluder wrote:
>>> But transactions aren't actions. I'd even argue that putting this convenience method on CATransaction might have been a mistake.
>>
>>
>> It's not merely a convenience. We live in an age of blocks; we want the block-based approach to replace the old delegate-based approach. One is not merely a convenient form of the other; they are fundamentally different architectures. For true layer animation (as opposed to view animation) this *is* the block-based approach. Apple did not give a CAAnimation a completion block property, so you *have* to use CATransaction to get one. m.
>
> As I mentioned before, we subclasses CAAnimationGroup to put the completion handler in the "right" (logically consistent) place.
FYI - I filed an enhancement request to add a block to animations instead of having to use the delegate. It was closed and I was told to use a CATransaction's completion block.
> It's unsafe in the sense that if you call out to other code that
> creates nested transactions, the assumption that your completion
> handler will be called at the time that your last action finishes is
> no longer valid.
"your last action" wasn't quite clear to me, but I assume you meant the last action in the outer transaction only. In other words, if the nested transactions take longer than the outer actions, you expect the outer transaction's completion block to be called first? I don't. I expect it to be called after all nested actions occur. If you want to know when *only the specific actions* are done, you'd use the animation delegate callback stuff as you suggest.
But the only way to know when all nested things are done, is the transaction's completion block.
I guess since nobody else has chimed in on the behavior I'm seeing, I'll file report about it and see what Apple has to say about it.
--
Seth Willits
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden