CATransaction setCompletionBlock - Nested Transactions bug?
CATransaction setCompletionBlock - Nested Transactions bug?
- Subject: CATransaction setCompletionBlock - Nested Transactions bug?
- From: Seth Willits <email@hidden>
- Date: Sun, 7 Nov 2010 13:29:55 -0800
Questions:
a) Why does the first code snippet call the completion block "immediately"?
b) If you assume A's answer is logical and correct, why does adding a completion block to the inner transaction affect the outer?
Something seems wrong here.
Code:
[CATransaction begin];
[CATransaction setCompletionBlock:^{
NSLog(@"Completion block");
}];
[CATransaction begin];
[CATransaction setValue:[NSNumber numberWithFloat:1.0] forKey:kCATransactionAnimationDuration];
layer.position = p;
[CATransaction commit];
[CATransaction commit];
NSLog(@"After commit");
Result:
0.000 seconds - After commit
0.002 seconds - Completion block
Code:
[CATransaction begin];
[CATransaction setCompletionBlock:^{
NSLog(@"Completion block");
}];
[CATransaction begin];
[CATransaction setValue:[NSNumber numberWithFloat:1.0] forKey:kCATransactionAnimationDuration];
[CATransaction setCompletionBlock:^{
NSLog(@"Inner completion block");
}];
layer.position = p;
[CATransaction commit];
[CATransaction commit];
NSLog(@"After commit");
Result:
0.000 seconds - After commit
1.000 seconds - Inner completion block
1.000 seconds - Completion block
--
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