SDLAddSubMenu Class Reference

Section Contents

Overview

Add a SDLSubMenu to the Command Menu

A SDLSubMenu can only be added to the Top Level Menu (i.e.a SDLSubMenu cannot be added to a SDLSubMenu), and may only contain commands as children

HMILevel needs to be FULL, LIMITED or BACKGROUND

Since SmartDeviceLink 1.0
see SDLDeleteSubMenu SDLAddCommand SDLDeleteCommand

-initWithMenuID:menuName:

Objective-C

- (nonnull instancetype)initWithMenuID:(UInt32)menuID
                              menuName:(nonnull NSString *)menuName;

Swift

init(menuID: UInt32, menuName: String)

Parameters

menuID

- @(menuID)

menuName

- menuName

Return Value

A SDLAddSubMenu object

-initWithMenuID:menuName:position:menuIcon:menuLayout:parentID:

Objective-C

- (nonnull instancetype)initWithMenuID:(UInt32)menuID
                              menuName:(nonnull NSString *)menuName
                              position:(nullable NSNumber<SDLUInt> *)position
                              menuIcon:(nullable SDLImage *)menuIcon
                            menuLayout:(nullable SDLMenuLayout)menuLayout
                              parentID:(nullable NSNumber<SDLUInt> *)parentID;

Swift

init(menuID: UInt32, menuName: String, position: (NSNumber & SDLUInt)?, menuIcon: SDLImage?, menuLayout: SDLMenuLayout?, parentID: (NSNumber & SDLUInt)?)

Parameters

menuID

- @(menuID)

menuName

- menuName

position

- position

menuIcon

- menuIcon

menuLayout

- menuLayout

parentID

- parentID

Return Value

A SDLAddSubMenu object

-initWithMenuID:menuName:position:menuIcon:menuLayout:parentID:secondaryText:tertiaryText:secondaryImage:

Objective-C

- (nonnull instancetype)initWithMenuID:(UInt32)menuID
                              menuName:(nonnull NSString *)menuName
                              position:(nullable NSNumber<SDLUInt> *)position
                              menuIcon:(nullable SDLImage *)menuIcon
                            menuLayout:(nullable SDLMenuLayout)menuLayout
                              parentID:(nullable NSNumber<SDLUInt> *)parentID
                         secondaryText:(nullable NSString *)secondaryText
                          tertiaryText:(nullable NSString *)tertiaryText
                        secondaryImage:(nullable SDLImage *)secondaryImage;

Swift

init(menuID: UInt32, menuName: String, position: (NSNumber & SDLUInt)?, menuIcon: SDLImage?, menuLayout: SDLMenuLayout?, parentID: (NSNumber & SDLUInt)?, secondaryText: String?, tertiaryText: String?, secondaryImage: SDLImage?)

Parameters

menuID

- @(menuID)

menuName

- menuName

position

- position

menuIcon

- menuIcon

menuLayout

- menuLayout

parentID

- parentID

secondaryText

- secondaryText

tertiaryText

- tertiaryText

secondaryImage

- secondaryImage

Return Value

A SDLAddSubMenu object

menuID

a Menu ID that identifies a sub menu @discussion This value is used in SDLAddCommand to which SDLSubMenu is the parent of the command being added

Objective-C

@property (nonatomic, strong) NSNumber<SDLInt> *_Nonnull menuID;

Swift

var menuID: NSNumber & SDLInt { get set }

position

a position of menu @discussion An NSNumber pointer representing the position within the items of the top level Command Menu. 0 will insert at the front, 1 will insert after the first existing element, etc. Position of any submenu will always be located before the return and exit options

Notes:

Objective-C

@property (nonatomic, strong, nullable) NSNumber<SDLInt> *position;

Swift

var position: (NSNumber & SDLInt)? { get set }

menuName

a menuName which is displayed representing this submenu item @discussion NSString which will be displayed representing this submenu item

Objective-C

@property (nonatomic, strong) NSString *_Nonnull menuName;

Swift

var menuName: String { get set }

menuIcon

An image that is displayed alongside this submenu item

Objective-C

@property (nonatomic, strong, nullable) SDLImage *menuIcon;

Swift

var menuIcon: SDLImage? { get set }

menuLayout

The sub-menu layout. See available menu layouts on SDLWindowCapability.menuLayoutsAvailable. Defaults to LIST.

Objective-C

@property (nonatomic, strong, nullable) SDLMenuLayout menuLayout;

Swift

var menuLayout: SDLMenuLayout? { get set }

parentID

Unique ID of the sub menu the command will be added to. If not provided or 0, it will be provided to the top level of the in application menu. {“default_value”: 0, “max_value”: 2000000000, “min_value”: 0}

@since SDL 7.0.0

Objective-C

@property (nonatomic, strong, nullable) NSNumber<SDLUInt> *parentID;

Swift

var parentID: (NSNumber & SDLUInt)? { get set }

secondaryText

Optional secondary text to display {“string_min_length”: 1, “string_max_length”: 500}

@added in SmartDeviceLink 7.1.0

Objective-C

@property (nonatomic, strong, nullable) NSString *secondaryText;

Swift

var secondaryText: String? { get set }

tertiaryText

Optional tertiary text to display {“string_min_length”: 1, “string_max_length”: 500}

@added in SmartDeviceLink 7.1.0

Objective-C

@property (nonatomic, strong, nullable) NSString *tertiaryText;

Swift

var tertiaryText: String? { get set }

secondaryImage

Optional secondary image struct for sub-menu cell

@added in SmartDeviceLink 7.1.0

Objective-C

@property (nonatomic, strong, nullable) SDLImage *secondaryImage;

Swift

var secondaryImage: SDLImage? { get set }