AWFLegendView
Objective-C
@interface AWFLegendView : UIView
Swift
class AWFLegendView : UIView
AWFLegendView
is a container view used for managing and displaying multiple AWFLegendItemView
instances for a weather map.
-
An array of
AWFLegendItemView
instances currently displayed.Declaration
Objective-C
@property (nonatomic, strong, readonly) NSArray<AWFLegendItemView *> *legends;
Swift
var legends: [AWFLegendItemView]! { get }
-
The text style to apply to the legend row title labels.
Declaration
Objective-C
@property (nonatomic, strong) AWFTextStyleSpec *titleTextStyle
-
The text style to apply to the legends, which controls legend value labels and titles.
Declaration
Objective-C
@property (nonatomic, strong) AWFTextStyleSpec *legendTextStyle
-
A Boolean value indicating whether the legend view should display the legends with Metric values when applicable.
Declaration
Objective-C
@property (nonatomic, getter=isMetric) BOOL metric;
Swift
var isMetric: Bool { get set }
-
The padding to use around the legend views relative to the view’s bounds.
Declaration
Objective-C
@property (nonatomic) UIEdgeInsets contentEdgeInsets;
Swift
var contentEdgeInsets: UIEdgeInsets { get set }
-
The outer margins for the container view.
Declaration
Objective-C
@property (nonatomic) UIEdgeInsets outerEdgeInsets;
Swift
var outerEdgeInsets: UIEdgeInsets { get set }
-
The position orientation of the view relative to its superview, which controls where the expand/collapse button and indicator are positioned.
Declaration
Objective-C
@property (nonatomic) AWFWeatherMapLegendPosition position;
Swift
var position: AWFWeatherMapLegendPosition { get set }
-
The button used to toggle the view’s visibility and expand/collapse state.
Declaration
Objective-C
@property (nonatomic, strong, readonly) UIButton *toggleButton;
Swift
var toggleButton: UIButton! { get }
-
A Boolean value indicating whether the view should show the close arrow indicator on the
toggleButton
. Default isYES
.Declaration
Objective-C
@property (nonatomic) BOOL showsCloseIndicator;
Swift
var showsCloseIndicator: Bool { get set }
-
A Boolean value indicating whether the view is currently shown/expanded or hidden/collapsed.
Use
show:animated:
to set the expanded/collapsed state.Declaration
Objective-C
@property (nonatomic, readonly, getter=isExpanded) BOOL expanded;
Swift
var isExpanded: Bool { get }
-
Initializes and returns a newly allocated
AWFWeatherMapLegendView
associated with the specified weather map’sconfig
.Declaration
Objective-C
- (instancetype)initWithMapStyle:(AWFWeatherMapStyle *)style frame:(CGRect)frame;
Swift
init!(mapStyle style: AWFWeatherMapStyle!, frame: CGRect)
Parameters
style
The weather map style
frame
The initial frame for the view
Return Value
An initialized
AWFWeatherMapLegendView
, ornil
if one couldn’t be created -
Adds an legend view for the specified layer type.
Declaration
Objective-C
- (void)addLegendForLayerType:(AWFMapLayer)layerType;
Swift
func addLegend(forLayerType layerType: AWFMapLayer!)
Parameters
layerType
The layer type code to add a legend for
-
Removes the legend view for the specified layer type.
Declaration
Objective-C
- (void)removeLegendForLayerType:(AWFMapLayer)layerType;
Swift
func removeLegend(forLayerType layerType: AWFMapLayer!)
Parameters
layerType
The layer type code to remove the legend for
-
A Boolean value indicating whether a legend is currently displayed for the specified layer type.
Declaration
Objective-C
- (BOOL)hasLegendForLayerType:(AWFMapLayer)layerType;
Swift
func hasLegend(forLayerType layerType: AWFMapLayer!) -> Bool
Parameters
layerType
The layer type code to check
Return Value
YES
if the legend exists, otherwiseNO
. -
Shows or hides the view, which is either expanded or collapsed respectively.
Use
expanded
to get the current shown/hidden state.Declaration
Objective-C
- (void)show:(BOOL)show animated:(BOOL)animated;
Swift
func show(_ show: Bool, animated: Bool)
Parameters
show
A Boolean indiciating whether to show the view
animated
A Boolean indicating whether the action should be animated
-
Tells the legend view to update any legend item views that require updating when a map’s coordinate bounds have changed, such as updating an advisories legend to only show active advisories within a specific region.
Declaration
Objective-C
- (void)updateItemsForMapBoundsIfNeeded:(AWFMapCoordinateBounds *)bounds;
Swift
func updateItems(forMapBoundsIfNeeded bounds: AWFMapCoordinateBounds!)
Parameters
bounds
The coordinate bounds to use when updating.