When I set the backgroundColor property of an CALayer instance, the change seems to be slightly animated. But I don't want that in my case. How can I set the backgroundColor without animation?
+1
A:
You can wrap the change in a CATransaction with disabled animations:
[CATransaction begin];
[CATransaction setValue:(id)kCFBooleanTrue forKey:kCATransactionDisableActions];
//change background colour
[CATransaction commit];
Ben
2010-10-07 17:38:45
Any way to disable it completely for every future property setting in CALayer? I'm changing some properties like 20 times per second...
openfrog
2010-10-07 17:49:17
I think you'll have to wrap your changes in these blocks to stop the implicit animations. I believe there might be a way to stop them by changing the delegate of the CALayer to nil but I'm not sure that method is supported if it even worked.
Ben
2010-10-07 17:52:54
+1
A:
Try giving your layer a delegate and then have the delegate return NSNull for actionForLayer:forKey:.
cgarman
2010-10-07 18:34:00