-2

I am not familiar with CoreGraphics and UIBezierPath's, but I have to draw 90 degree gauge with two halves: positive & negative. I want to be able to draw the progress (positive or negative) with a gauge arrow. However, I can't draw the graph. Afterwards the arrow won't be that problem

So, can someone tell me how to draw arcs with UIBezierPath (without making it part of a circle?

Thanks in advance, L.

something like this, but in two halves

But only two parts

Lucifer
  • 480
  • 3
  • 12
  • I'm not sure I understand what you want... Is it anything [like this](http://stackoverflow.com/q/35039208/2976878)? Adding a picture to the OP showing what you want would be helpful, along with any code that you've already tried. – Hamish Feb 18 '16 at 14:52
  • Can't provide you with a complete answer but you might find http://stackoverflow.com/questions/1734745/how-to-create-circle-with-b%C3%A9zier-curves helpful in drawing your circle-arc(s). then it just becomes a point of connecting the dots. – Cat'r'pillar Feb 18 '16 at 15:34
  • "something like this, but in two halves" What does that mean? Please show what you _want_, not what you _don't_ want. – matt Feb 18 '16 at 15:35

1 Answers1

3

Taking a stab in the dark, but you're likely to want to create a UIBezierPath + bezierPathWithArcCenter:radius:startAngle:endAngle:clockwise: , create a CAShapeLayer and set the path from the bezier, then set a suitably wide lineWidth (the default line cap is a butt, i.e. imagine a thin rectangular pen nib that is as tall as the line width being run along the path).

Seriously consider creating a subclass of UIView that sits atop a shape layer, because then you'll be able to place and size in the interface builder, apply layout constraints, etc.

Tommy
  • 99,986
  • 12
  • 185
  • 204
  • Thanks, that would do :) – Lucifer Feb 18 '16 at 15:57
  • ... also note `startStart` and `strokeEnd` on the shape layer, which are animatable, should you want a presentation animation that involves the thing growing outward, or want to add a gauge-like indicator. If those comments, not really tied to your question, are helpful. – Tommy Feb 18 '16 at 16:03