Panel Widgets - dji-sdk/Mobile-UXSDK-Beta-iOS GitHub Wiki
Table of Contents
Panels Overview
The panel architecture is designed as a cluster of classes used to group a set of widgets in a specific ways for presentation to the user. These panels can be used to create Bar Panels, Toolbar Panels, and List Panels.
A Bar Panel (DUXBetaBarPanelWidget
) is for presenting a row or column of icons which are self contained, such as the status widgets in the top bar or side bar of an application.
The Toolbar Panel (DUXBetaToolbarPanelWidget
) widget, is a widget for displaying a single sub-widget at a time based on the selection of widgets shown as a strip of icons along the edge of the panel. Toolbars may be vertically or horizontally oriented.
List Panels (DUXBetaListPanelWidget) are for displaying widgets which are primarily lists of items such as settings or status information. They are only oriented vertically.
Details about each of the individual types may be found on itโs own page.
Panel Configuration Overview
Panels have certain abstractions which apply to all the panels types in the cluster and are implemented in the DUXBetaPanelWidget base class. When combined with the configuration object, the resulting panel is ready to have widgets added and be installed in a view.
All panels are configured with two parameters passed to the DUXBetaPanelWidgetConfiguration constructor. The configuration can also be used to set panel color information and a titlebar where appropriate.
Panels are defined using a DUXBetaPanelType and DUXBetaPanelVariant. The variant specifies positioning and orientation for the panel.
Panel Types are:
Type | Description |
---|---|
DUXBetaPanelTypeBar | A bar of widgets, useful for a status bar along one edge of a screen or inside another container. Bar Panel Widgets have at left/right or top/bottom section |
DUXBetaPanelTypeToolbar | A Toolbar Panel Widget |
DUXBetaPanelTypeList | A List Panel Widget for displaying a list of widgets, vertically oriented |
For detailed information, see Panel Widget Configuration.
Base Panel Methods
These are the methods common to all Panel widgets. Specialized panels have additional methods relating to their function. Those methods are discussed on the individual panel pages.
Swift
init()
init?(coder: NSCoder)
func configure(_ config:DUXBetaPanelWidgetConfiguration) -> DUXBetaPanelWidget
func widget(configuration: DUXBetaPanelWidgetConfiguration) -> DUXBetaPanelWidget?
Objective-C
- (instancetype)init;
- (instancetype)initWithCoder(NSCoder*)coder;
- (instancetype)configure:(DUXBetaPanelWidgetConfiguration*)configObject;
+ (instancetype)widget:(DUXBetaPanelWidgetConfiguration*)configObject;
These methods are the standard initialization methods, and the configuration method. The configuration methods are designed to work with call chaining so an entire panel can be created with a single line of code if desired.
Adding Widgets to Panels
The following methods are used to add widgets to the panel containers. Specific panel types have additional methods related to their specialization.
Swift
func addWidgetArray(_ displayWidgets: [DUXBetaBaseWidget]) -> Void
func widgetCount() -> Int
func insert(widget: DUXBetaBaseWidget, atIndex: Int) -> Void
func removeAllWidgets() -> Void
Objective-C
- (void) addWidgetArray:(NSArray<DUXBetaBaseWidget*>)displayWidgets;
- (NSInteger) widgetCount;
- (void) insert:(DUXBetaBaseWidget*)widget atIndex:(NSInteger)index;
- (void) removeAllWidgets;
Title bar manipulation
Swift
func hideTitleBar() -> Void
func showTitleBar() -> Void
Objective-C
- (void) hideTitleBar;
- (void) showTitleBar;
Usage
If creating a panel widget through code it can be added using the convenience method:
- (void)installInViewController:(nullable UIViewController *)viewController