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
Post a Comment