Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
How do I make the radial gauge fill out its whole circle?


I've created some radial gauges inside of CGRect objects and I want the edge of each gauge to touch the sides of the rectangle.

The problem is that the backingShape is extending far beyond the edge of the "ticks" and everything else. So the backing is touching the sides of the box, but the useful part of the gauge is only about half the radius of the backing.

I've tried adjusting the backingOuterExtent value to less than 1, but this makes the backing smaller instead of the rest of the gauge bigger.

How do I push the rest of the gauge (ticks, labels, needle) out to the edge of the backing, so that the gauge is as large as possible for the space it's confined to?

  • 115
    Offline posted

    Here's what I'm doing right now to get the effect I'm looking for (Swift 4):

    let gauge = IGGaugeView.init(frame: CGRect.init(x: 0 - container.frame.size.width*0.3, y: 0 - container.frame.size.height*0.3, width: container.frame.size.width*1.6, height: container.frame.size.height*1.6)

    gauge.autoresizingMask = [ UIViewAutoresizing.flexibleHeight, UIViewAutoresizing.flexibleWidth ]

    gauge.backingOuterExtent = 0.62

    This is working. The backingExtent only slightly extends past the gauge ticks, and it completely fills the subview that it's embedded in. The problem with this is that the invisible part of the gauge extends quite a bit outside of the container, which might cause weird things to happen with touch events.

    Is there a more elegant way to achieve this effect?

Reply Children