Skip to content

RC Distance Widget

UX SDK Core Team edited this page Jun 11, 2019 · 1 revision

The RC distance widget shows the distance between the current location of the aircraft and the location of the RC (pilot). This widget uses the unit set in the global preferences and defaults to meters.

Images/DashboardWidgetImages/DistanceRCWidget.gif

Usage

If creating the RC distance widget through code it can be added using the convenience method:

- (void)installInViewController:(nullable UIViewController *)viewController

which adds the widget the method is called on as a subview of the ViewController that is passed in as an argument. Following this add constraints to the widget using its widgetSizeHint property to determine width, height and aspect ratio constraints.

If creating the widget through storyboard use the object library to drag a container view controller into the desired view controller like so:

Following this make sure to change the class of the child view controller to be DUXRCDistanceWidget. From here you can create the constraints on the container view using the RC Distance Widget's widgetSizeHint property.

Customizations

The RC distance widget supports customization of its light and dark font colors.

To get this effect we would use the following code:

Swift

rcDistanceWidget.lightFontColor = UIColor.green
rcDistanceWidget.darkFontColor = UIColor.blue

Objective C

rcDistanceWidget.lightFontColor = [UIColor greenColor];
rcDistanceWidget.darkFontColor = [UIColor blueColor];

Full list of properties

List of the customizable properties
  • lightFontColor - Font color for the RC distance value, defaults to white.
  • darkFontColor - Font color for the RC distance unit and name, defaults to gray.
Clone this wiki locally