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).

Deprecated in v2.0 (scheduled for removal).

Other Methods

+ questionStepWithIdentifier:title:question:answer:

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

+ (instancetype)questionStepWithIdentifier:(NSString *)identifier title:(nullable NSString *)title question:(nullable NSString *)question 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.

question

A localized string that represents the question as a text.

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

  question

The question for the step.

@property (nonatomic, strong, nullable) NSString *question

Discussion

Different from the step title.

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

  useCardView

A property to present the question with a card view. Default to YES;

@property (nonatomic) BOOL useCardView

Declared In

ORKQuestionStep.h

Deprecated Methods

+ questionStepWithIdentifier:title:answer:

Returns a new question step that includes the specified identifier, title, question, 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 question.

answerFormat

The format in which the answer is expected.

Declared In

ORKDeprecated.h

+ questionStepWithIdentifier:title:text:answer:

Returns a new question step that includes the specified identifier, title, question, 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 question.

text

The primary text shown below the title string.

answerFormat

The format in which the answer is expected.

Declared In

ORKDeprecated.h