Hierarchy Collection Item¶
FUIHierarchyCollectionItem
¶
open class FUIHierarchyCollectionItem: FUITableViewAccessoryDrawingCollectionViewCell<FUIHierarchyItemView>, InnerViewContainerEventHandling, FUIContentCopyable
FUIHierarchyCollectionItem
is a collection view UI component which extends FUITableViewAccessoryDrawingCollectionViewCell
for showing a collection item's business object content and hierarchy information (e.g. number of children in its next level). It is the default cell for displaying hierarchy items in an FUIHierarchyView
.
Initialization and Configuration¶
To use FUIHierarchyCollectionItem
, it should be dequeued from hierarchyView
and returned in the data source method in FUIHierarchyViewDataSource
.
Example of setting an FUIHierarchyCollectionItem
by implementing cellForItemWith
in the hierarchy view:
cell.title.text = "Business Object Title"
cell.subtitle.text = "Business Object Subtitle"
cell.footnote.text = "Business Object Footnote"
cell.accessoryType = .disclosureIndicator
cell.statusImage = FUIIconLibrary.indicator.veryHighPriority
cell.hierarchyIndicator.title.text = "999,999"
Hierarchy Indicator¶
Hierarchy indicator provides a stacked view which includes two components: a text view, and a hierarchy icon. In hierarchy view, the text view is used to show the number of children belongs to the specific hierarchy item. Once the hierarchy indicator is tapped, the hierarchy view will be expanded to display a list of its children in a new column. The icon indicates that if the hierarchy item has been expanded or not. To customize a different text in hierarchy indicator, set the text
for title
property of the cell's FUIHierarchyIndicator
.
cell.hierarchyIndicator.title.text = "My Title"
Hierarchy indicator has two ways to layout its components: multi-line mode and single-line mode. By default, it is displayed in a vertical aligned multi-line mode. To horizontally align its components in a single-line mode, configure the isMultiline
property of the cell's FUIHierarchyIndicator
.
cell.hierarchyIndicator.isMultiline = false
Default Styling¶
Depending on the selection state, the tint color and button style of hierarchy icon, the font size of the title text, and the cell's background color will be updated automatically.
Customize Selection Behavior¶
By default after selection the hierarchy item cell will be expanded. Selection behavior can be customized by conforming to FUIHierarchyViewDelegate
and then implementing the hierarchyButtonTappedForItemWith
method. To support additional gesture handling, a developer would usually add a gesture recognizer. This can be added directly to the cell when it is being dequeued, or added to collection view containing the cell.
In the following example, a long press gesture recognizer is added to each hierarchy collection cell:
let longPressGestureRecognizer = UILongPressGestureRecognizer(target: self, action: #selector(didLongPress(_:)))
longPressGestureRecognizer.minimumPressDuration = 0.5
cell.addGestureRecognizer(longPressGestureRecognizer)
Theming¶
Supported class paths:
fdlFUIHierarchyCollectionItem {}
Please refer to FUIHierarchyItemView
and FUIHierarchyIndicator
documentation for all supported attributes.