My question is on the title.
I don't know how to add a border in a specific side, top or bottom, any side…
layer.border
draws the border for the whole view…
borderiosobjective cuiviewxcode
My question is on the title.
I don't know how to add a border in a specific side, top or bottom, any side…
layer.border
draws the border for the whole view…
Best Answer
I consider subclassing
UIView
and overridingdrawRect
overkill here. Why not add an extension onUIView
and add border subviews?With this code you're not tied to your subclass too, you can apply it to anything and everything that inherits from
UIView
- reusable in your project, and any others. Pass in other arguments to your methods to define other colours and widths. Many options.