tags:

views:

36

answers:

2

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
Any way to disable it completely for every future property setting in CALayer? I'm changing some properties like 20 times per second...
openfrog
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
+1  A: 

Try giving your layer a delegate and then have the delegate return NSNull for actionForLayer:forKey:.

cgarman