ORKScaleAnswerFormat Class Reference

Inherits from ORKAnswerFormat : NSObject
Declared in ORKAnswerFormat.h

The ORKScaleAnswerFormatclass represents an answer format that includes a slider control.

The scale answer format produces an ORKScaleQuestionResult object that contains an integer whose value is between the scale’s minimum and maximum values, and represents one of the quantized step values.

The following are the rules bound with scale answer format -

  • Minimum number of step in a task should not be less than 1.
  • Minimum number of section on a scale (step count) should not be less than 1.
  • Maximum number of section on a scale (step count) should not be more than 13.
  • The lower bound value in scale answer format cannot be lower than - 10000.
  • The upper bound value in scale answer format cannot be more than 10000.

– initWithMaximumValue:minimumValue:defaultValue:step:vertical:maximumValueDescription:minimumValueDescription:

Returns an initialized scale answer format using the specified values.

- (instancetype)initWithMaximumValue:(NSInteger)maximumValue minimumValue:(NSInteger)minimumValue defaultValue:(NSInteger)defaultValue step:(NSInteger)step vertical:(BOOL)vertical maximumValueDescription:(nullable NSString *)maximumValueDescription minimumValueDescription:(nullable NSString *)minimumValueDescription

Parameters

maximumValue

The upper bound of the scale.

minimumValue

The lower bound of the scale.

defaultValue

The default value of the scale. If this value is out of range, the slider is displayed without a default value.

step

The size of each discrete offset on the scale.

vertical

Pass YES to use a vertical scale; for the default horizontal scale, pass NO.

maximumValueDescription

A localized label to describe the maximum value of the scale. For none, pass nil.

minimumValueDescription

A localized label to describe the minimum value of the scale. For none, pass nil.

Return Value

An initialized scale answer format.

Discussion

This method is the designated initializer.

Declared In

ORKAnswerFormat.h

– initWithMaximumValue:minimumValue:defaultValue:step:vertical:

Returns an initialized scale answer format using the specified values.

- (instancetype)initWithMaximumValue:(NSInteger)maximumValue minimumValue:(NSInteger)minimumValue defaultValue:(NSInteger)defaultValue step:(NSInteger)step vertical:(BOOL)vertical

Parameters

maximumValue

The upper bound of the scale.

minimumValue

The lower bound of the scale.

defaultValue

The default value of the scale. If this value is out of range, the slider is displayed without a default value.

step

The size of each discrete offset on the scale.

vertical

Pass YES to use a vertical scale; for the default horizontal scale, pass NO.

Return Value

An initialized scale answer format.

Discussion

This method is a convenience initializer.

Declared In

ORKAnswerFormat.h

– initWithMaximumValue:minimumValue:defaultValue:step:

Returns an initialized horizontal scale answer format using the specified values.

- (instancetype)initWithMaximumValue:(NSInteger)maximumValue minimumValue:(NSInteger)minimumValue defaultValue:(NSInteger)defaultValue step:(NSInteger)step

Parameters

maximumValue

The upper bound of the scale.

minimumValue

The lower bound of the scale.

defaultValue

The default value of the scale. If this value is out of range, the slider is displayed without a default value.

step

The size of each discrete offset on the scale.

Return Value

An initialized scale answer format.

Discussion

This method is a convenience initializer.

Declared In

ORKAnswerFormat.h

  maximum

The upper bound of the scale. (read-only)

@property (readonly) NSInteger maximum

Declared In

ORKAnswerFormat.h

  minimum

The lower bound of the scale. (read-only)

@property (readonly) NSInteger minimum

Declared In

ORKAnswerFormat.h

  step

The size of each discrete offset on the scale. (read-only)

@property (readonly) NSInteger step

Discussion

The value of this property should be greater than zero. The difference between maximumValue and minimumValue should be divisible by the step value.

Declared In

ORKAnswerFormat.h

  defaultValue

The default value for the slider. (read-only)

@property (readonly) NSInteger defaultValue

Discussion

If the value of this property is less than minimum or greater than maximum, the slider has no default. Otherwise, the value is rounded to the nearest valid step value.

Declared In

ORKAnswerFormat.h

  vertical

A Boolean value indicating whether the scale is oriented vertically. (read-only)

@property (readonly, getter=isVertical) BOOL vertical

Declared In

ORKAnswerFormat.h

  numberFormatter

Number formatter applied to the minimum, maximum, and slider values. Can be overridden by subclasses.

@property (readonly) NSNumberFormatter *numberFormatter

Declared In

ORKAnswerFormat.h

  maximumValueDescription

A localized label to describe the maximum value of the scale. (read-only)

@property (readonly, nullable) NSString *maximumValueDescription

Declared In

ORKAnswerFormat.h

  minimumValueDescription

A localized label to describe the minimum value of the scale. (read-only)

@property (readonly, nullable) NSString *minimumValueDescription

Declared In

ORKAnswerFormat.h

  maximumImage

An image for the upper bound of the slider. The recommended image size is 30 x 30 points. The maximum range label will not be visible.

@property (strong, nullable) UIImage *maximumImage

Declared In

ORKAnswerFormat.h

  minimumImage

An image for the lower bound of the slider. The recommended image size is 30 x 30 points. The minimum range label will not be visible.

@property (strong, nullable) UIImage *minimumImage

Declared In

ORKAnswerFormat.h

  gradientColors

The colors to use when drawing a color gradient above the slider. Colors are drawn such that lower indexes correspond to the minimum side of the scale, while colors at higher indexes in the array corresond to the maximum side of the scale.

@property (copy, nullable) NSArray<UIColor*> *gradientColors

Discussion

Setting this value to nil results in no gradient being drawn. Defaults to nil.

An example usage would set an array of red and green to visually indicate a scale from bad to good.

Declared In

ORKAnswerFormat.h

  gradientLocations

Indicates the position of gradient stops for the colors specified in gradientColors. Gradient stops are specified as values between 0 and 1. The values must be monotonically increasing.

@property (copy, nullable) NSArray<NSNumber*> *gradientLocations

Discussion

If nil, the stops are spread uniformly across the range. Defaults to nil.

Declared In

ORKAnswerFormat.h