ORKHealthKitCharacteristicTypeAnswerFormat Class Reference
| Inherits from | ORKAnswerFormat : NSObject |
|---|---|
| Declared in | ORKHealthAnswerFormat.h ORKHealthAnswerFormat.m |
Overview
The ORKHealthKitCharacteristicTypeAnswerFormat class represents an answer format that lets participants enter values that correspond to a HealthKit characteristic type.
The actual UI used for collecting data with this answer format depends on the HealthKit type being collected.
The default value displayed in the UI is the most recent value received from HealthKit, if such a value exists.
When a step or item is presented using this answer format, authorization is requested unless the property
shouldRequestAuthorization is set to NO.
You can use the HealthKit characteristic answer format to let users autofill information, such as their blood type or date of birth.
Other Methods
– questionType
The type of question. (read-only)
- (ORKQuestionType)questionTypeDiscussion
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.
Declared In
ORKAnswerFormat.h
+ answerFormatWithCharacteristicType:
Returns a new answer format for the specified HealthKit characteristic type.
+ (instancetype)answerFormatWithCharacteristicType:(HKCharacteristicType *)characteristicTypeParameters
characteristicType |
The characteristic type to collect. |
|---|
Return Value
A new HealthKit characteristic type answer format instance.
Declared In
ORKHealthAnswerFormat.h
– initWithCharacteristicType:
Returns an initialized HealthKit characteristic type answer format using the specified characteristic type.
- (instancetype)initWithCharacteristicType:(HKCharacteristicType *)characteristicTypeParameters
characteristicType |
The characteristic type to collect. |
|---|
Return Value
An initialized HealthKit characteristic type answer format.
Discussion
This method is the designated initializer.
Declared In
ORKHealthAnswerFormat.h
– impliedAnswerFormat
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
@(YES) and @(NO), respectively, so its impliedAnswerFormat is an
ORKTextChoiceAnswerFormat with those options.
- (ORKAnswerFormat *)impliedAnswerFormatDeclared In
ORKAnswerFormat.h
Other Methods
shouldRequestAuthorization
Should authorization be requested for the associated HealthKit data type. Default = YES.
@property (nonatomic) BOOL shouldRequestAuthorizationDeclared In
ORKHealthAnswerFormat.h
characteristicType
The HealthKit characteristic type to be collected by this answer format. (read-only)
@property (nonatomic, copy, readonly) HKCharacteristicType *characteristicTypeDeclared In
ORKHealthAnswerFormat.h
defaultDate
The default date shown by the date picker.
@property (nonatomic, strong, nullable) NSDate *defaultDateDiscussion
Only used for the HKCharacteristicTypeIdentifierDateOfBirth characteristic type. The date is
displayed in the user’s time zone. If you set this property to nil, the date picker will default
to the date representing 35 years before the current date.
Declared In
ORKHealthAnswerFormat.h
minimumDate
The minimum date that is allowed by the date picker.
@property (nonatomic, strong, nullable) NSDate *minimumDateDiscussion
Only used for the HKCharacteristicTypeIdentifierDateOfBirth characteristic type. If you set this
property to nil, the date picker will use the date representing 150 years before the curent date
as its minimum date.
Declared In
ORKHealthAnswerFormat.h
maximumDate
The maximum date that is allowed by the date picker.
@property (nonatomic, strong, nullable) NSDate *maximumDateDiscussion
Only used for the HKCharacteristicTypeIdentifierDateOfBirth characteristic type. If you set this
property to nil, the date picker will use the date representing 1 day after curent date as its
maximum date
Declared In
ORKHealthAnswerFormat.h
calendar
The calendar used by the date picker.
@property (nonatomic, strong, nullable) NSCalendar *calendarDiscussion
Only used for the HKCharacteristicTypeIdentifierDateOfBirth characteristic type. If you set this
property to nil, the date picker will use the default calendar for the current locale.
Declared In
ORKHealthAnswerFormat.h