ORKAnswerFormat Class Reference
ORKAnswerFormat class is the abstract base class for classes that describe the
format in which a survey question or form item should be answered. The ResearchKit framework uses
ORKFormItem to represent questions to ask the user. Each
question must have an associated answer format.
To use an answer format, instantiate the appropriate answer format subclass and attach it to a question step or form item. Incorporate the resulting step into a task, and present the task with a task view controller.
An answer format is validated when its owning step is validated.
Some answer formats are constructed of other answer formats. When this is the
case, the answer format can override the method
impliedAnswerFormat to return
the answer format that is implied. For example, a Boolean answer format
is presented in the same way as a single-choice answer format with the
choices Yes and No mapping to
The type of question. (read-only)
@property (readonly) ORKQuestionType questionType
You can use this enumerated value in your Objective-C code to switch on a rough approximation of the type of question that is being asked.
Note that answer format subclasses override the getter to return the appropriate question type.
Validates the parameters of the answer format to ensure that they can be displayed.
Typically, this method is called by the validation methods of the owning objects, which are themselves called when a step view controller that contains this answer format is about to be displayed.
Some answer formats are constructed of other answer formats. This method allows
a subclass to return a different answer format for use in defining the UI/UX for
the answer format type. For example, a Boolean answer format is presented in the
same way as a single-choice answer format with the choices Yes and No mapping to
@(NO), respectively, so its
impliedAnswerFormat is an
ORKTextChoiceAnswerFormat with those options.
- (ORKAnswerFormat *)impliedAnswerFormat