-
Notifications
You must be signed in to change notification settings - Fork 15
Altitude Widget
The altitude widget shows the current altitude of the aircraft. This uses the unit set in the global preferences and defaults to meters.
Images/DashboardWidgetImages/AltitudeWidget.gif
If creating the altitude 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 DUXBetaAltitudeWidget
. From here you can create the constraints on the container view using the Altitude Widget's widgetSizeHint
property.
The altitude widget supports customization of its light and dark font colors, and its small and large fonts.
To get this effect we would use the following code:
altitudeWidget.lightFontColor = UIColor.green
altitudeWidget.darkFontColor = UIColor.blue
altitudeWidget.smallFont = UIFont(name: "Custom Font", size: 12.0)!
altitudeWidget.largeFont = UIFont(name: "Custom Font", size: 24.0)!
altitudeWidget.lightFontColor = [UIColor greenColor];
altitudeWidget.darkFontColor = [UIColor blueColor];
altitudeWidget.smallFont = [UIFont fontWithName:@"Custom Font" size:12.0];
altitudeWidget.largeFont = [UIFont fontWithName:@"Custom Font" size:24.0];
List of the customizable properties
-
lightFontColor
- Font color for the altitude value, defaults to white. -
darkFontColor
- Font color for the altitude unit and name, defaults to gray. -
smallFont
- Font for the altitude value. -
largeFont
- Font for the altitude unit and name.
DJI UX SDK Version 5 Beta 4.1