ORKTextChoice Class Reference

Inherits from NSObject
Conforms to NSCopying
NSObject
NSSecureCoding
Declared in ORKAnswerFormat.h

The ORKTextChoice class defines the text for a choice in answer formats such as ORKTextChoiceAnswerFormat and ORKValuePickerAnswerFormat.

When a participant chooses a text choice item, the value recorded in a result is specified by the value property.

+ choiceWithText:detailText:value:exclusive:

Returns a text choice object that includes the specified primary text, detail text, and exclusivity.

+ (instancetype)choiceWithText:(NSString *)text detailText:(nullable NSString *)detailText value:(id<NSCopying,NSCoding,NSObject>)value exclusive:(BOOL)exclusive

Parameters

text

The primary text that describes the choice in a localized string.

detailText

The detail text to display below the primary text, in a localized string.

value

The value to record in a result object when this item is selected.

exclusive

Whether this choice is to be considered exclusive within the set of choices.

Return Value

A text choice instance.

Declared In

ORKAnswerFormat.h

+ choiceWithText:value:

Returns a choice object that includes the specified primary text.

+ (instancetype)choiceWithText:(NSString *)text value:(id<NSCopying,NSCoding,NSObject>)value

Parameters

text

The primary text that describes the choice in a localized string.

value

The value to record in a result object when this item is selected.

Return Value

A text choice instance.

Declared In

ORKAnswerFormat.h

– initWithText:detailText:value:exclusive:

Returns an initialized text choice object using the specified primary text, detail text, and exclusivity.

- (instancetype)initWithText:(NSString *)text detailText:(nullable NSString *)detailText value:(id<NSCopying,NSCoding,NSObject>)value exclusive:(BOOL)exclusive

Parameters

text

The primary text that describes the choice in a localized string.

detailText

The detail text to display below the primary text, in a localized string.

value

The value to record in a result object when this item is selected.

exclusive

Whether this choice is to be considered exclusive within the set of choices.

Return Value

An initialized text choice.

Discussion

This method is the designated initializer.

Declared In

ORKAnswerFormat.h

  text

The text that describes the choice in a localized string.

@property (copy, readonly) NSString *text

Discussion

In general, it’s best when the text can fit on one line.

Declared In

ORKAnswerFormat.h

  value

The value to return when this choice is selected.

@property (copy, readonly) id<NSCopying,NSCoding,NSObject> value

Discussion

The value of this property is expected to be a scalar property list type, such as NSNumber or NSString. If no value is provided, the index of the option in the options list in the answer format is used.

Declared In

ORKAnswerFormat.h

  detailText

The text that provides additional details about the choice in a localized string.

@property (copy, readonly, nullable) NSString *detailText

Discussion

The detail text can span multiple lines. Note that ORKValuePickerAnswerFormat ignores detail text.

Declared In

ORKAnswerFormat.h

  exclusive

In a multiple choice format, this indicates whether this choice requires all other choices to be unselected.

@property (readonly) BOOL exclusive

Discussion

In general, this is used to indicate a “None of the above” choice.

Declared In

ORKAnswerFormat.h