tags:

views:

779

answers:

1

I'm wondering if there is a way to bring layer on top of others layers of view. Something like bringSubviewToFront does for UIView class. I think it can be done with zPosition property of the CALayer but this means I have to check zPosition for all layers and then set proper value.

Thanks in advance.

+2  A: 

I believe that the code (given that layer is your CALayer)

[layer retain];
CALayer *superlayer = layer.superlayer;
[layer removeFromSuperlayer];
[superlayer addLayer:layer];
[layer release];

will do what you want, albeit in a roundabout way.

ianh
Thanks a loot. That's what I need
Dmytro
how to swap the z-index of two layers?
Shivan Raptor