how to clear the whole render tree of CALayer fast and safely?
how to clear the whole render tree of CALayer fast and safely?
- Subject: how to clear the whole render tree of CALayer fast and safely?
- From: "Cloud Strife" <email@hidden>
- Date: Sat, 19 Jul 2008 13:20:24 +0800
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 (email@hidden)
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:
This email sent to email@hidden