ORKHealthKitCharacteristicTypeAnswerFormat Class Reference
Inherits from | ORKAnswerFormat : NSObject |
---|---|
Declared in | ORKHealthAnswerFormat.h |
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.
+ answerFormatWithCharacteristicType:
Returns a new answer format for the specified HealthKit characteristic type.
+ (instancetype)answerFormatWithCharacteristicType:(HKCharacteristicType *)characteristicType
Parameters
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 *)characteristicType
Parameters
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
shouldRequestAuthorization
Should authorization be requested for the associated HealthKit data type. Default = YES
.
@property (nonatomic) BOOL shouldRequestAuthorization
Declared In
ORKHealthAnswerFormat.h
characteristicType
The HealthKit characteristic type to be collected by this answer format. (read-only)
@property (nonatomic, copy, readonly) HKCharacteristicType *characteristicType
Declared In
ORKHealthAnswerFormat.h
defaultDate
The default date shown by the date picker.
@property (nonatomic, strong, nullable) NSDate *defaultDate
Discussion
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 *minimumDate
Discussion
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 *maximumDate
Discussion
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 *calendar
Discussion
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