Custom Needle for Shinobi Gauge


Hi,Im uncertain exaclty how to specify the custom needle for a gauge, as I cant seem to set its size after adding it. I cant seem to control the custom needles size, and any help would be apprecaited.  

Im simply trying to use my own image as the needle, however when I resize the gauge the image seems to scale non-uniformly, so I need some way to override the default size. Changing the size, widht, and border seems to have no effect.

self.gauge.needle = [[MYNeedle alloc] init]; = 1.0; = 0.1; = 10;


@interface MYNeedle:UIImageView<SGaugeNeedle>

@implementation MYNeedle
    self = [super init];
        self.autoresizesSubviews = YES;
        self.backgroundColor = [UIColor clearColor];
        self.layer.anchorPoint = CGPointMake(0.5, 1.0);
        self.image = [UIImage imageNamed:@"newneedle"];
        self.contentMode = UIViewContentModeScaleAspectFit;
        self.layer.masksToBounds = YES;
    return self;



Just to add to this, modifying the frame to a set width/height produces differnt results dependent upon the current angle of the needle, so thats not an option for me unless I can apply the transformation before the rotation.  

Any help is apprecaited, it really cant be that hard to add an image as the needle, so I assume I am overlooking something very basic and obvious.


Hello AEB,

Thanks for getting in touch!

We have a sample app that shows exactly how to do this called “GaugesHowToCustomNeedle” which can be found in the samples folder of your Shinobi Gauges download.

The sample sets the frame of the custom needle inside the ViewController.m file on line 30-31.

Let me know if you have any questions.

Kind regards,
Andrew Polkinghorn.


Thanks, never realized these were packaged with samples.  Does the needles style for length, width, and borderwidth apply to custom needles?  I notice it is not set here.

The main issue I run into is that the needle does not scale properly in relation to the other elements when I resize it, and modifying the frame manually results in skewed sizes for the needle.  I am assuming thats due to the transformations used to rotate being applied in an order which causes the frames settings to be skewed.



Unfortunately the style properties only work on our default needle, if you are wanting to resize your custom needle and update the style of it you will have to manage the images yourself.