Re: Reordering CALayer sublayers without raping my performance?
Re: Reordering CALayer sublayers without raping my performance?
- Subject: Re: Reordering CALayer sublayers without raping my performance?
- From: David Duncan <email@hidden>
- Date: Fri, 16 Nov 2007 11:08:16 -0800
On Nov 16, 2007, at 10:54 AM, Jonathan del Strother wrote:
Hmm, you're right.
Am I misreading this, or does the "Layer Geometry and Transforms"
page tell me something completely different :
"The zPosition is intended to be used to set the visual position of
the layer relative to its sibling layers. It should not be used to
specify the order of layer siblings, instead reorder the layer in
the sublayer array."
Well, it is performing a sort when you set zPosition :). So it can be
more expensive than just reordering the sublayers array, certainly so
if you only have a 2D presentation. An alternative to try is disabling
transactions while your rearranging the sublayers array, like this
[CATransaction begin];
[CATransaction setValue:(id)kCFBooleanTrue
forKey:kCATransactionDisableActions];
// do your sublayer rearrangement here
[CATransaction commit];
Of course, if you ever plan to go for a 2.5D scene (ala Coverflow)
then you will need to deal with zPosition, as the layer order isn't
enough to get the correct appearance in that situation.
--
David Duncan
Apple DTS Animation and Printing
email@hidden
_______________________________________________
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