0

I have this custom layout as in this picture :

Layout

The four rectangles are UIViews with border lines over a CALayer. In the middle of this rectangles are another UIView as a circle. I would like to draw the border line of the circle where the rectangles are open. The difficulty is that the rectangles are autoresizing and the UIView in the middle. How can I make that ?

Rob
  • 415,655
  • 72
  • 787
  • 1,044
Rolf Warnecke
  • 107
  • 1
  • 10
  • Create a `UIBezierPath` for your outline. It's just a series of `addLineToPoint` and `addArcWithCenter`. You can then define your own custom `UIView` subclass and `stroke` that path in the `drawRect` routine, or create a `CAShapeLayer` with this as its path (wiht this latter approach, you'd have to update the `path` on `viewWillLayoutSubviews`. – Rob Jun 25 '16 at 09:57
  • Can detect UIBezierPath and CAShapeLayer that the UIVIews are resizing ? – Rolf Warnecke Jun 25 '16 at 10:00
  • No, that's why you would update the `path` property of the `CAShapeLayer` in `viewWillLayoutSubviews` or `layoutSubviews`. Manually stroking it yourself in `drawRect` is effectively the same thing. See http://stackoverflow.com/a/16846770/1271826 for basic idea. – Rob Jun 25 '16 at 10:02

0 Answers0