ORKImageChoice Class Reference

Inherits from NSObject
Conforms to NSCopying
NSSecureCoding
Declared in ORKAnswerFormat.h

The ORKImageChoice class defines a choice that can be included in an ORKImageChoiceAnswerFormat object.

Typically, image choices are displayed in a horizontal row, so you need to use appropriate sizes. For example, when five image choices are displayed in an ORKImageChoiceAnswerFormat, image sizes of about 45 to 60 points allow the images to look good in apps that run on all versions of iPhone.

The text that describes an image choice should be reasonably short. However, only the text for the currently selected image choice is displayed, so text that wraps to more than one line is supported.

+ choiceWithNormalImage:selectedImage:text:value:

Returns an image choice that includes the specified images and text.

+ (instancetype)choiceWithNormalImage:(nullable UIImage *)normal selectedImage:(nullable UIImage *)selected text:(nullable NSString *)text value:(id<NSCopying,NSCoding,NSObject>)value

Parameters

normal

The image to display in the unselected state.

selected

The image to display in the selected state.

text

The text to display when the image is selected.

value

The value to record in a result object when the image is selected.

Return Value

An image choice instance.

Declared In

ORKAnswerFormat.h

– initWithNormalImage:selectedImage:text:value:

Returns an initialized image choice using the specified images and text.

- (instancetype)initWithNormalImage:(nullable UIImage *)normal selectedImage:(nullable UIImage *)selected text:(nullable NSString *)text value:(id<NSCopying,NSCoding,NSObject>)value

Parameters

normal

The image to display in the unselected state.

selected

The image to display in the selected state.

text

The text to display when the image is selected.

value

The value to record in a result object when the image is selected.

Return Value

An initialized image choice.

Discussion

This method is the designated initializer.

Declared In

ORKAnswerFormat.h

  normalStateImage

The image to display when the choice is not selected. (read-only)

@property (strong, readonly) UIImage *normalStateImage

Discussion

The size of the unselected image depends on the number of choices you need to display. As a general rule, it’s recommended that you start by creating an image that measures 44 x 44 points, and adjust it if necessary.

Declared In

ORKAnswerFormat.h

  selectedStateImage

The image to display when the choice is selected. (read-only)

@property (strong, readonly, nullable) UIImage *selectedStateImage

Discussion

For best results, the selected image should be the same size as the unselected image (that is, the value of the normalStateImage property). If you don’t specify a selected image, the default UIButton behavior is used to indicate the selection state of the item.

Declared In

ORKAnswerFormat.h

  text

The text to display when the image is selected, in a localized string. (read-only)

@property (copy, readonly, nullable) NSString *text

Discussion

Note that the text you supply may be spoken by VoiceOver even when the item is not selected.

Declared In

ORKAnswerFormat.h

  value

The value to return when the image is selected. (read-only)

@property (copy, readonly) id<NSCopying,NSCoding,NSObject> value

Discussion

The value of this property is expected to be a scalar property list type, such as NSNumber or NSString. If no value is provided, the index of the option in the ORKImageChoiceAnswerFormat options list is used.

Declared In

ORKAnswerFormat.h