views:

40

answers:

1

Hi all,

I've created a bunch of sublayers within my view, populating each one with a graphic, so effectively they are sprites. However, when I call [lineLayer setValue:[NSNumber numberWithFloat:0.5] forKeyPath:@"transform.scale"] it appears to 'tween' to that size instead of just appearing at the new scale.

Is there any way of switching off this behaviour? I just want to change the scale directly.

Thanks!

:-Joe

+1  A: 

Ahhh I just answered my own question... I keep doing that on here!

From the help:

You can temporarily disable layer actions when changing layer property values by setting the value of the transaction’s kCATransactionDisableActions to true. Any changes made during the scope of that transaction will not result in an animation occurring. Listing 2 shows an example that disables the fade animation that occurs when removing aLayer from a visible layer-tree.

[CATransaction begin];
[CATransaction setValue:(id)kCFBooleanTrue
                 forKey:kCATransactionDisableActions];
[aLayer removeFromSuperlayer];
[CATransaction commit];
Joe