Hi, everyone.Assuming there is a Core Animation render tree with many
calayers and complex levels, should I use the iteration function to remove
one layer from one layer or there just is some useful function to delete the
whole render tree neatly at once to make the app robust ?

After created and some work to the existing render tree, I want to clean it
to release the CPU and memory and GPU it occupied. Because the performance
and stability are the main keys of my application. I wrote some ugly code to
do that, as expected, the result is very bad, my application crashed ...
:-(

[self cleanWindowContentViewSubLayers:[[[_aWindow contentView] layer]
sublayers ]];


-(void) cleanWindowContentViewSubLayers:(NSArray*)_Layers{

int i, count = [_Layers count];

for(i = 0;i < count; i++){

CALayer* _oneLayer = (CALayer*)[_Layers objectAtIndex:i];

[self cleanWindowContentViewSubLayers:[_oneLayer sublayers]];

//if the _oneLayer is the leaf of the render tree, when iterating the next
level of the stack, the for statement won't execute for the _Layers == nil

                //then we can delete it

                [_oneLayer removeFromSuperlayer];

[_oneLayer release];

}

}

here are so many smart developers. Would any one give me a guidance to
accomplish this task?

Any discussion or help is highly welcome. :-)

Thank you in advance.



-- 
Best regards.
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to