-
Notifications
You must be signed in to change notification settings - Fork 15
RC Stick Mode List Item Widget
RC Stick Mode List Item Widget is a DUXBetaListItemRadioButtonWidget which displays the RC Stick Modes also known as Aircraft Mapping Styles. The currently enabled mode will be highlighted. The widget provides functionality to change the mode by tapping on any option.
Following are examples of the widget states:
Disconnected
Mode 1
Mode 3
To add the RC Stick Mode List Item Widget to your DUXBetaSmartListModel
class, override buildModelLists
and include DUXBetaRCStickModeListItemWidget.duxbeta_className()
or [DUXBetaRCStickModeListItemWidget duxbeta_className]
in your modelClassnameList
:
@objc open class MySmartListModel : DUXBetaSmartListModel {
@objc open override func buildModelLists() {
super.buildModelLists()
self.modelClassnameList.append(DUXBetaRCStickModeListItemWidget.duxbeta_className())
}
}
@interface DUXBetaTestSmartListModel : DUXBetaSmartListModel
@end
@implementation DUXBetaTestSmartListModel
- (void)buildModelLists {
[super buildModelLists];
[self.modelClassnameList append:[DUXBetaRCStickModeListItemWidget duxbeta_className]];
}
@end
The UI elements can be customized to match the style of the user's application. The widget supports all the customizations that its parent, DUXBetaListItemRadioButtonWidget supports. An example of a customized RC stick mode list item widget in various states could look something like this:
To get this effect we would use the following code:
stickModeWidget.titleColor = .red
stickModeWidget.setTextColor(.gray, for: .normal)
stickModeWidget.setTextColor(.black, for: .disabled)
stickModeWidget.titleColor = UIColor.redColor;
[stickModeWidget setTextColor:UIColor.grayColor forState:UIControlStateNormal];
[stickModeWidget setTextColor:UIColor.blackColor forState:UIControlStateDisabled];
The widget provides hooks for the users to add functionality based on the state changes in the widget. The RC stick mode list item widget provides the following hooks:
-
RCModeListItemModelState
- Provides hooks for events received by the widget from the widget model. It inherits from ListItemRadioButtonModelState and adds the following hooks:
-
+ (instancetype)setRCStickModeSucceded;
- Event when setting the RC stick mode succeeds. -
+ (instancetype)rcStickModeUpdateFailed:(NSError *)error;
- Event when setting the RC stick mode fails. -
+ (instancetype)rcStickModeUpdated:(DJIRCAircraftMappingStyle)newMode;
- Event when the RC stick mode is updated.
-
RCModeListItemUIState
- Provides hooks for events received by the widget from user interactions. It inherits from ListItemRadioButtonUIState and adds no additional hooks.
DJI UX SDK Version 5 Beta 4.1