iphone - iOS Core Animation: CALayer bringSublayerToFront? -


how bring calayer sublayer front of sublayers, analogous -[uiview bringsubviewtofront]?

this variation of @mattdipasquale's implementation reflects uiview's logic more precisely:

- (void) bringsublayertofront:(calayer *)layer {     [layer removefromsuperlayer];     [self insertsublayer:layer atindex:[self.sublayers count]]; }  - (void) sendsublayertoback:(calayer *)layer {     [layer removefromsuperlayer];     [self insertsublayer:layer atindex:0]; } 

note: if don't use arc, may wish add [layer retain] @ top , [layer release] @ bottom of both functions make sure layer not accidentally destructed in case has retain count = 1.


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -