Click here to Skip to main content
15,885,874 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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.
Posted
Updated 29-Nov-13 5:41am
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900