Theocacao
Leopard
Design Element
Comment on "Core Animation Sample Code: NanoLife"
by Adrian Bool — Feb 23
Scott, Could I ask you why you use extra local variables in your code, such as,

// create container layer for spheres
CALayer* sphereContainer = [CALayer layer];
sphereContainer.name = @"sphereContainer";
[mainLayer addSublayer:sphereContainer];
self.containerLayerForSpheres = sphereContainer;

As opposed to,

// create container layer for spheres
self.containerLayerForSpheres = [CALayer layer];
self.containerLayerForSpheres.name = @"sphereContainer";
[mainLayer addSublayer:self.containerLayerForSpheres];

You perform a similar action with sphereCount as well. I'm learning Cocoa and would love to know if the second form is significantly less efficient or if there is some other possible problem. Cheers!
Back to "Core Animation Sample Code: NanoLife"
Design Element

Copyright © Scott Stevenson 2004-2015