ios - Swift: remove layer, without removing UIView in UITableViewCell -
i have uitableviewcell uiview
in it. made cabasicanimation , attach new cashapelayer, add layer super layer in uitableviewcell:
self.layer.addsublayer(mylayer!)
all nice except mylayer (and animation) showing above uiview
. want label below uiview
.
i achieve adding uiview
layer same way:
self.layer.addsublayer(myviewlayer!)
in case, uiview
layer on top of cashapelayer animation.
but have problem, need remove layer of uiview - myviewlayer
because violates width of uiview when scroll.
when animation done, , need remove layers, can remove cashapelayer - mylayer without troubles.
mylayer?.removefromsuperlayer()
but when try same myviewlayer
, uiview removed too. don't want that, need uiview on screen , in view hierarchy.
i don't understand why, if self.layer.sublayers
see (before adding layers):
[<calayer: 0x7fd1f0d4fe40>, <calayer: 0x7fd1f0ddc950>]
and after animation done , mylayer removed:
[<calayer: 0x7fd1f0d4fe40>, <calayer: 0x7fd1f0ddc950>, <cagradientlayer: 0x7fd1f0de3660>]
as can see cagradientlayer layer of uiview. so, haven't before manually add sublayers array. how can remove it, without removing uiview?
or how can add mylayer below uiview?
edit
in few words have layer hierarchy before animation:
[<calayer: 0x7fd1f0d4fe40> <- (i think uitableviewcell layer), <calayer: 0x7fd1f0ddc950> <- (then, uitableviewcell content view layer)]
in same time, have view hierarchy:
uitableviewcell -> content view -> uiview
i need add new layer animation, below uiview (i want uiview partially cover new layer animation). how can this?
i haven't uiview layer in uitableview layer hierarchy, can't add layer animation using addlayer:below:
, on.
you can add mylayer
below uiview.layer
setting
mylayer.zposition = -1
Comments
Post a Comment