ios8 - swift label only border left -
good morning together,
example: in cell 1 have got red text label on right side. left include image grey line.
with code can set complete green border:
cell.label.layer.borderwidth = 0.5 cell.label.layer.bordercolor = uicolor.greencolor().cgcolor
can set border on left side text label? use swift ios8 - so, need swift solution
here extension can add project:
extension calayer { func addborder(edge: uirectedge, color: uicolor, thickness: cgfloat) { var border = calayer() switch edge { case uirectedge.top: border.frame = cgrectmake(0, 0, cgrectgetheight(self.frame), thickness) break case uirectedge.bottom: border.frame = cgrectmake(0, cgrectgetheight(self.frame) - thickness, uiscreen.mainscreen().bounds.width, thickness) break case uirectedge.left: border.frame = cgrectmake(0, 0, thickness, cgrectgetheight(self.frame)) break case uirectedge.right: border.frame = cgrectmake(cgrectgetwidth(self.frame) - thickness, 0, thickness, cgrectgetheight(self.frame)) break default: break } border.backgroundcolor = color.cgcolor; self.addsublayer(border) } }
and use this:
cell.label.layer.addborder(uirectedge.top, color: uicolor.greencolor(), thickness: 0.5)
Comments
Post a Comment