-(void) bringSublayerToFront:(CALayer*)layer
{[layer removeFromSuperlayer];[self insertSublayer:layer atIndex:[self.sublayers count]-1];}-(void) sendSublayerToBack:(CALayer*)layer
{[layer removeFromSuperlayer];[self insertSublayer:layer atIndex:0];}
Note: if you don‘t use ARC, you may wish to 
add [layer retain] at top and [layer 
release] at bottom of both functions to make 
sure layer is not accidentally destructed in a case it 
has retain count = 1.
iOS Core Animation: CALayer bringSublayerToFront?,布布扣,bubuko.com
iOS Core Animation: CALayer bringSublayerToFront?
原文:http://www.cnblogs.com/spiderdzl/p/3713992.html