ORKQuestionStep Class Reference

Inherits from ORKStep : NSObject
Declared in ORKQuestionStep.h

The ORKQuestionStep class is a concrete subclass of ORKStep that represents a step in which a single question is presented to the user.

To use a question step, instantiate an ORKQuestionStep object, fill in its properties, and include it in a task. Next, create a task view controller for the task and present it. When the task completes, the user’s answer is encoded in the result hierarchy in the task view controller.

When a task view controller presents an ORKQuestionStep object, it instantiates an ORKQuestionStepViewController object to present the step. The actual visual presentation depends on the answer format.

When you need to present more than one question at the same time, it can be appropriate to use ORKFormStep instead of ORKQuestionStep.

The result of a question step is an ORKStepResult object that includes a single child (ORKQuestionResult).

+ questionStepWithIdentifier:title:answer:

Returns a new question step that includes the specified identifier, title, and answer format.

+ (instancetype)questionStepWithIdentifier:(NSString *)identifier title:(nullable NSString *)title answer:(nullable ORKAnswerFormat *)answerFormat

Parameters

identifier

The identifier of the step (a step identifier should be unique within the task).

title

A localized string that represents the primary text of the question.

answerFormat

The format in which the answer is expected.

Declared In

ORKQuestionStep.h

+ questionStepWithIdentifier:title:text:answer:

Returns a new question step that includes the specified identifier, title, text, and answer format.

+ (instancetype)questionStepWithIdentifier:(NSString *)identifier title:(nullable NSString *)title text:(nullable NSString *)text answer:(nullable ORKAnswerFormat *)answerFormat

Parameters

identifier

The identifier of the step (a step identifier should be unique within the task).

title

A localized string that represents the primary text of the question.

text

A localized string that represents the additional text of the question.

answerFormat

The format in which the answer is expected.

Declared In

ORKQuestionStep.h

  answerFormat

The format of the answer.

@property (nonatomic, strong, nullable) ORKAnswerFormat *answerFormat

Discussion

For example, the answer format might include the type of data to collect, the constraints to place on the answer, or a list of available choices (in the case of single or multiple select questions).

Declared In

ORKQuestionStep.h

  questionType

The question type. (read-only)

@property (nonatomic, readonly) ORKQuestionType questionType

Discussion

The value of this property is derived from the answer format.

Declared In

ORKQuestionStep.h

  placeholder

A localized string that represents the placeholder text displayed before an answer has been entered.

@property (nonatomic, copy, nullable) NSString *placeholder

Discussion

For numeric and text-based answers, the placeholder content is displayed in the text field or text area when an answer has not yet been entered.

Declared In

ORKQuestionStep.h