Inherits from UIView
Declared in SGauge.h
Availability
Related samples

Overview

The SGauge is a component representing a single value. They appear in one of two layout styles:

The gauge indicates the current value with a needle, pointing towards the value.

Styling Axes and Axis Labels

Styling the Needle

Applying colors to the Ranges and Background

It can also optionally color some sections of the gauge, to indicate special values. For example, a car revometer may wish to colour values above 7000 rpm in red, to indicate a “danger zone”.

Tasks

Setup

Configuration

Appearance

Delegation

  •   delegate

    The delegate used by the gauge, to inform of changes to the gauge. See the SGaugeDelegate protocol for more details.

    property

Properties

axis

The axis displayed around the perimeter of the gauge.

@property (nonatomic, retain) SGaugeAxis *axis

Discussion

This may be in a linear or radial display, depending on the gauge. Includes major and minor tick marks, and labels.

Declared In

SGauge.h

delegate

The delegate used by the gauge, to inform of changes to the gauge. See the SGaugeDelegate protocol for more details.

@property (nonatomic, assign) id<SGaugeDelegate> delegate

Declared In

SGauge.h

maximumValue

The maximum range of the gauge.

@property (nonatomic, retain) NSNumber *maximumValue

Declared In

SGauge.h

minimumValue

The minimum range of the gauge.

@property (nonatomic, retain) NSNumber *minimumValue

Declared In

SGauge.h

needle

The needle object, used to point to the current value.

@property (nonatomic, retain) UIView<SGaugeNeedle> *needle

Discussion

Defaults to a single black line, in the center of the gauge.

Declared In

SGauge.h

qualitativeRangeZPosition

The z-ordering of the qualitative ranges. Defaults to 0.

@property (nonatomic, assign) CGFloat qualitativeRangeZPosition

Discussion

When used in conjunction with the zPosition property on the layer of the SGaugeNeedle and SGaugeAxis, the order to draw each in can be specified.

Declared In

SGauge.h

qualitativeRanges

An array of SGaugeQualitativeRange objects, to indicate sections of the gauge which will be coloured.

@property (nonatomic, retain) NSArray *qualitativeRanges

Declared In

SGauge.h

style

The style to use for drawing the gauge, the axis and the needle.

@property (nonatomic, retain) SGaugeStyle *style

Declared In

SGauge.h

value

The current value of the gauge

@property (nonatomic, assign) CGFloat value

Declared In

SGauge.h

Class Methods

getInfo

Returns information about the current build version and type of the ShinobiGauges project.

+ (NSString *)getInfo

Declared In

SGauge.h

Instance Methods

angleOfValue:

The angle at which an element should be rotated to, at a given value. Measured in radians.

- (CGFloat)angleOfValue:(CGFloat)value

Parameters

value

The value within the gauge range

Used for displaying the needle, tick marks, and tick labels. On an SGaugeLinear, this just returns 0.

Declared In

SGauge.h

getInfo

Returns information about the current build version and type of the ShinobiGauges project.

- (NSString *)getInfo

Declared In

SGauge.h

initWithFrame:fromMinimum:toMaximum:

Create a gauge with a given range.

- (id)initWithFrame:(CGRect)frame fromMinimum:(NSNumber *)minimum toMaximum:(NSNumber *)maximum

Parameters

frame

The size and position of the gauge

minimum

The minimum value of the axis

maximum

The maximum value of the axis

Declared In

SGauge.h

positionOfValue:atOffset:

Translates a value on the gauge to a coordinate.

- (CGPoint)positionOfValue:(CGFloat)value atOffset:(CGFloat)offset

Parameters

value

The value within the gauge range

offset

The offset in points from the axis

This is primarily used to calculate tick marks, and should be referenced if creating custom tickmarks.

Declared In

SGauge.h

setLicenseKey:

Set the license key for the trial version of the ShinobiGauges framework. You will be emailed the license key when you download the framework.

- (void)setLicenseKey:(NSString *)licenseKey

Declared In

SGauge.h

setValue:duration:

Set the value of the gauge, and animate the needle to the new position.

- (void)setValue:(CGFloat)value duration:(CGFloat)duration

Discussion

If duration is 0, then no animation will occur.

Declared In

SGauge.h