ios - Bring subview to front -


i having issue want bring badge notification view add uicollectionviewcell front. adding border uicollectionviewcell using cell.layer.bordercolor = [[uicolor redcolor]cgcolor]; . when border added appears on top of badge view.

enter image description here

after adding border:

enter image description here

i add badge view cell using, [self addsubview:self.badge]; in class subclasses uicollectionviewcell

i tried, [self bringsubviewtofront:self.badge]; , self.badge.layer.zposition = 1; didn't help. found these solutions on similar posts on so, think doing wrong. glad if point out. thank you.

edit did little change according suggestions, , did [self.contentview addsubview:self.badge]; instead of [self addsubview:self.badge];. when debug view , check layers of view, show badge on top of border, thats not case in simulator.

as @iphonic said, cannot achieve these using same view draw border , contain badge.

try set these view hierarchy:

cell    |- contentview       |- main view (apply border here)          |- content       |- badge 

Comments