ORKQuestionStepViewController Class Reference
| Inherits from | ORKStepViewController : UIViewController |
|---|---|
| Declared in | ORKQuestionStepViewController.h ORKQuestionStepViewController.m |
Overview
The ORKQuestionStepViewController class is the concrete ORKStepViewController
implementation for ORKQuestionStep.
You should not need to instantiate an ORKQuestionStepViewController object
directly. Instead, create an ORKQuestionStep object, include it in a task
the task using a task view controller. The task view
controller automatically instantiates the question step view controller
when it needs to present a question step.
To use ORKQuestionStepViewController directly, create an ORKQuestionStep object and use
initWithStep: to initialize it. To receive the result of the question, and to determine
when to dismiss the view controller, implement ORKStepViewControllerDelegate.
Other Methods
– initWithStep:result:
- (instancetype)initWithStep:(ORKStep *)step result:(ORKResult *)resultReturn Value
A newly initialized step view controller.
Declared In
ORKStepViewController.h
– setCancelButtonItem:
The cancel button item.
- (void)setCancelButtonItem:(UIBarButtonItem *)cancelButtonItemDiscussion
The cancel button item controls the Cancel button displayed in the navigation bar when the step view controller is current. This property lets you control the appearance and target of the Cancel button at runtime.
When the value of the property is nil, the Cancel button is not displayed; otherwise, the title, target,
and action associated with the Cancel button item are used (other properties of UIBarButtonItem
are ignored).
The cancel button item is updated during view loading and when the value of the step property
is changed, but is safe to
set in the taskViewController:stepViewControllerWillAppear: delegate callback.
Subclasses can safely modify this property any time after calling viewWillAppear: on super.
Declared In
ORKStepViewController.h
– result
The current state of the result. (read-only)
- (ORKStepResult *)resultDiscussion
The task view controller uses this property to get the results for the step, and to collate them into the task result.
The current step result and any subsidiary results representing data collected
so far are available in this property. You can detect significant changes to the result,
such as when the user enters a new answer, using the
stepViewControllerResultDidChange: delegate callback.
Subclasses must use this property to return the current results. Subclasses may call super to obtain a clean, empty result object appropriate for the step, to which they can attach appropriate child results.
The implementations of this method in the ResearchKit framework currently create a new result object on every call, so do not call this method unless it is actually necessary.
Declared In
ORKStepViewController.h
– skipForward
This method is called when the user taps the skip button. By default, it calls goForward.
- (void)skipForwardDeclared In
ORKStepViewController.h
– goForward
Navigates forward to the next step.
- (void)goForwardDiscussion
When a user taps a Next button, the information passes through this method. You can use this method as an override point or a target action for a subclass.
Declared In
ORKStepViewController.h
– goBackward
Navigates backward to the previous step.
- (void)goBackwardDiscussion
When a user taps the Back button, the information passes through this method. You can use this method as an override point or a target action for a subclass.
Declared In
ORKStepViewController.h
Extension Methods
customQuestionView
Provide a custom question view.
@property (nonatomic, strong, nullable) ORKQuestionStepCustomView *customQuestionViewDiscussion
If a question requires a custom control for data entry, provide a suitable
custom step view. This view should provide -sizeThatFits: or autolayout
constraints which determine the vertical space required.
Declared In
ORKQuestionStepViewController_Private.h