Skip to content

Home Distance Widget

Shane Looker edited this page May 15, 2020 · 2 revisions

The home distance widget shows the distance between the current location of the aircraft and its home location. This widget uses the unit set in the global preferences and defaults to meters.

Images/DashboardWidgetImages/HomeDistanceWidget.gif

Usage

If creating the home 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 DUXBetaHomeDistanceWidget. From here you can create the constraints on the container view using the Home Distance Widget's widgetSizeHint property.

Customizations

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

To get this effect we would use the following code:

Swift

homeDistanceWidget.lightFontColor = UIColor.green
homeDistanceWidget.darkFontColor = UIColor.blue

Objective C

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

Full list of properties

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