ORKQuestionStep Class Reference
| Inherits from | ORKStep : NSObject |
|---|---|
| Declared in | ORKQuestionStep.h ORKQuestionStep.m |
Overview
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 *)answerFormatParameters
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
– initWithIdentifier:
- (instancetype)initWithIdentifier:(NSString *)identifierDeclared In
ORKStep.h
– validateParameters
Checks the parameters of the step and throws exceptions on invalid parameters.
- (void)validateParametersDiscussion
This method is called when there is a need to validate the step’s parameters, which is typically
the case when adding a step to an ORKStepViewController object, and when presenting the
step view controller.
Subclasses should override this method to provide validation of their additional properties, and must call super.
Declared In
ORKStep.h
– questionType
The question type. (read-only)
- (ORKQuestionType)questionTypeDiscussion
The value of this property is derived from the answer format.
Declared In
ORKQuestionStep.h
– requestedHealthKitTypesForReading
The set of HealthKit types the step requests for reading. (read-only)
- (NSSet<HKObjectType*> *)requestedHealthKitTypesForReadingDiscussion
The task view controller uses this set of types when constructing a list of all the HealthKit types required by all the steps in a task, so that it can present the HealthKit access dialog just once during that task.
By default, the property scans the recorders and collates the HealthKit types the recorders require. Subclasses may override this implementation.
Declared In
ORKStep.h
Other Methods
answerFormat
The format of the answer.
@property (nonatomic, strong, nullable) ORKAnswerFormat *answerFormatDiscussion
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 *questionDiscussion
Different from the step title.
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 *placeholderDiscussion
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 useCardViewDeclared 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 *)answerFormatParameters
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 *)answerFormatParameters
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