I've created user-drawn controls in iOS before. Subcall UIView
, override DrawRect
; cool.
I've created layouts with AutoLayout; cool.
After many hours of trying, I cannot combine the two. I've tried using the UIView
subclass method; the CALayerDelegate
method; and a few others.
The core problem is that drawing on a CGContext
requires knowing the Frame
or Bounds
, and neither of these are available at runtime using these methods.
I am trying to perform what I think is a very simple task. I want to create a border around a view such that 1, 2, 3, or 4 sides can be drawn.
All my searches lead to 3 or 4 unresolved Stack Overflow questions.
The only semi-helpful suggestion I have seen is that it may not be possible, and to use 4 additional UIViews to create the borders. That's plan-B but it seems like an unnecessary overhead and a little insane considering the scope of the problem.
Any help would be appreciated.