I have a chart which is in the shape of an gauge which has multiple design elements to it (see attachment). Key parts I'm struggling with is really getting a decent arc shape with dashed lines.
So far I'm not sure if I should be going down Core Graphics route or using something within UIKit, i.e. UIBezierPath.
I've tried this within a class that extend UIView which gives me the dashed lines but the arc itself isn't quite good enough:
class Example: UIView {
override func drawRect(rect: CGRect) {
let context = UIGraphicsGetCurrentContext()
CGContextSetLineWidth(context, 10.0)
CGContextSetStrokeColorWithColor(context, UIColor.greenColor().CGColor)
let dashArray:[CGFloat] = [1,10, 0, 0]
CGContextSetLineDash(context, 2, dashArray, 4)
CGContextMoveToPoint(context, 10, 200)
CGContextAddQuadCurveToPoint(context, 0, 0, 100, 200)
CGContextStrokePath(context)
}
}
There are then some other ways to get this going using UIBezierPath but I'm not sure how I would go about applying the dashed lines through here...
The main base of getting the arc with dashed lines is my main goal atm - I'm sure once I get this I'll be able to workout the gradient and animation :)
Any help would be appreciated :)