Re: Problem getting my layers to draw in the right order
Re: Problem getting my layers to draw in the right order
- Subject: Re: Problem getting my layers to draw in the right order
- From: David Duncan <email@hidden>
- Date: Mon, 25 Jul 2011 10:18:18 -0700
On Jul 24, 2011, at 9:46 PM, Graham Cox wrote:
> I'm having a problem establishing the right Z-ordering of Core Animation layers in a view. I've tried carefully controlling the stacking order of the view's sublayers, and I've also tried setting the zPosition property, but the problem I'm having remains.
>
> Here's a screen shot: http://apptree.net/images/salayer_problem.png
>
> The view's hosting layer contains 3 layers, all of which are CAReplicatorLayers, to provide the reflection effect. The left and right 'bargraph' layers are supposed to be behind the 'title' layer. As you can see, the one on the left is behind, but the one on the right draws the reflection in front of the text. Nothing I do seems to make any difference to the front-to-back ordering of the layers - naturally I want the text in front of all.
>
> I thought perhaps it's due to how reflections are calculated, but if that were the case the reflection on the left would draw over the text as well.
>
> Each of these three layers are directly set as sublayers of the view's hosting layer, and in turn the three have further sublayers to define and draw their content.
>
> I'm pretty new to Core Animation, and this is the first time I've used CAReplicatorLayer. Does anyone have some idea what's going on here?
Without seeing exactly how you are laying out your layers, my recommendation would be to add more layers :). To your root layer, add the replicator layer and the text layer, and then add the rest of your content to the replicator as you already do. By having the text layer order after the replicator layer, it should draw on top of it and you should get what you are looking for.
--
David Duncan
_______________________________________________
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