Setting multiple borders on UIView

后端 未结 5 455
庸人自扰
庸人自扰 2021-01-13 17:39

As I cannot find any questions/answers for this, I imagine it is not possible.

Is there anyway to set multiple borders on a UIView.

I am curren

5条回答
  •  野的像风
    2021-01-13 18:20

    That isn't possible with a single UIView instance without adding layers.

    What you can do is create a view that is larger than necessary, set its border appropriately, then add a CALayer and position it where you want the inner border and set its border properties appropriately.

    Using CALayers is typically faster than full blown UIView, but you can also just have a nested UIView to achieve the same effect.

提交回复
热议问题