-
Notifications
You must be signed in to change notification settings - Fork 15
List Item Label Button Widget
The widget is an extension of the List Item Title Widget. The primary purpose of this widget is to display read only values and enable user interaction.
override init() {
super.init(.labelOnly)
// Instantiate other variables
}
required init?(coder: NSCoder) {
super.init(.labelOnly)
// Instantiate other variables
}
- (instancetype)init {
if (self = [super init:DUXBetaListItemLabelOnly]) {
// Instantiate other variables
}
return self;
}
- (instancetype)initWithCoder:(NSCoder*)coder {
if (self = [super init:DUXBetaListItemLabelOnly]) {
// Instantiate other variables
}
return self;
}
The WidgetType supports three values:
It inherits the title icon and title text and its customizations from the List Item Title Widget. Additionally it provides a label for displaying values and supports all the label customizations mentioned below.
Example of the widget is Flight Mode List Item Widget
It inherits the title icon and title text and its customizations from the List Item Title Widget. Additionally it provides a button for user interaction and supports all the button customizations mentioned below.
It inherits the title icon and title text and its customizations from the List Item Title Widget. Additionally it provides a button for user interaction and a label for displaying values. The widget supports all the button customizations and label customizations mentioned below.
Example of the widget is SD Card Status
The UI elements can be customized to match the style of the user's application. The customizations can be done programmatically using the APIs.
List of the customization APIs
-
- (void)setLabelText:(NSString *)labelText
- The string to be displayed in the label. -
UIFont *labelFont
- The font of the label. -
UIColor *disconnectedValueColor;
- The color to draw the information area text when disconnected. (inherited) -
UIColor *normalValueColor;
- The color to draw the information area text when active. (inherited)
List of the customization APIs
-
- (void)setButtonTitle:(NSString*)newButtonTitle;
- The string to be displayed on the button. -
- (instancetype)setButtonAction:(GenericButtonActionBlock)action;
- Set the executable block which is called when the button is pressed. -
- (GenericButtonActionBlock)getButtonAction;
- Get the executable block which is called when the button is pressed. -
UIFont *buttonFont;
- The font/size to draw the button label for sub-classes with buttons. -
float buttonBorderWidth;
- The width of the button border for sub-classes with buttons. -
float buttonCornerRadius;
- The curvature radius for the border put on the buttons or controls for sub-classes with controls. -
- (UIColor *)buttonBorderNormalColor;
- The color to use for drawing button border color in a normal state. This method can be overridden by the sub-class. -
- (UIColor *)buttonBorderDisabledColor;
- The color to use for drawing button border color in a disabled state. This method can be overridden by the sub-class. -
- (UIColor *)buttonBorderSelectedColor;
- The color to use for drawing button border color in a selected state. This method can be overridden by the sub-class. -
- (void)setButtonColor:(UIColor *)buttonColor forUIControlState:(UIControlState)controlState;
- Set the color for drawing any subclass button for the given control state. -
- (UIColor *)getButtonColorForUIControlState:(UIControlState)controlState;
- Get the color for drawing any subclass button for the given control state. -
- (void)setButtonBorderColor:(UIColor *)buttonColor forUIControlState:(UIControlState)controlState;
- Set the color for drawing any subclass button border for the given control state. -
- (UIColor *)getButtonBorderColorForUIControlState:(UIControlState)controlState;
- Get the color for drawing any subclass button border for the given control state. -
- (void)setButtonBackgroundColor:(UIColor *)buttonBackgroundColor forUIControlState:(UIControlState)controlState;
- Set the color for drawing the button background fill of any subclass button for the given control state. -
- (UIColor *)getButtonBackgroundColorForUIControlState:(UIControlState)controlState;
- Get the color for filling the background of any subclass button for the given controlState.
The widget provides hooks for users to add functionality based on state changes in the widget.
The List Item Label Button widget provides the following hooks:
-
ListItemLabelButtonModelState
- Provides hooks in events received by the widget from the widget model. It inherits ListItemTitleModelState and it adds no other hooks. -
ListItemLabelButtonUIState
- Provides hooks in events received by the widget from the user interface interactions. It inherits ListItemTitleUIState and it adds the following hooks:
-
+ (instancetype)buttonTapped;
- Event sent when the actionButton is tapped. Always sends YES as an NSNumber.
DJI UX SDK Version 5 Beta 4.1