FUIGridTableViewHeaderFooterView

open class FUIGridTableViewHeaderFooterView : FUIBaseTableViewHeaderFooterView, FUIContentCopyable

FUIGridTableViewHeaderFooterView is a FIori UI component that extends UITableViewHeaderFooterView for showing a list of FUIGridRowItem column titles. It will display as a section header or footer in table view.

Columns widths may be specified in absolute points, or as a set of fractions in 0.0..<1. A developer may also designate one column for flexible width, by assigning the value -1 to that column width.

Remark

Developers should always use the same column widths or percents for all headers, footers and rows in a grid. Developers should also set common accessory types to rows, headers and footers.

The FUIGridTableViewHeaderFooterView is adaptive for regular and compact horizontal content modes. It is hidden by design, when in compact mode. The AutoLayout automatic dimension technique should be used for computing the height.

Example Initialization and Configuration:

override open func viewDidLoad() {
super.viewDidLoad()
tableView.sectionHeaderHeight = UITableViewAutomaticDimension
tableView.estimatedSectionHeaderHeight = 100
tableView.register(FUIGridTableViewHeaderFooterView.self, forHeaderFooterViewReuseIdentifier: FUIGridTableViewHeaderFooterView.reuseIdentifier)
}

Override tableView(_: viewForHeaderInSection:) dataSource method and configure header.

// header data list
var headerData: [FUIGridRowItem] {
let item0 = FUIGridRowHeaderItem(text: " ")
let item1 = FUIGridRowHeaderItem(text: "Symbol")
let item2 = FUIGridRowHeaderItem(text: "Open")
let item3 = FUIGridRowHeaderItem(text: "High")
let item4 = FUIGridRowHeaderItem(text: "Low")
let item5 = FUIGridRowHeaderItem(text: "Close")
return [item0, item1, item2, item3, item4, item5]
}

// set column widths.  Should be shared by rows and header.
let columnWidths = [-1, 0.2, 0.1, 0.1, 0.1, 0.1]

// configure header view
header.items = headerData
header.columnWidthPercent = columnWidths
header.accessoryType = .disclosureIndicator // match row cell accessory types!

  • An array of FUIGridRowItem objects in the header.

    Declaration

    Swift

    public var items: [FUIGridRowItem]? { get set }
  • An array of fixed width for each column.

    Set -1 for that column if it should have dynamic width. At most one column can be dynamic. For example, [50, -1, 100] means the width of first column is 50, width of third column is 100 and second column will take the remaining space available.

    Declaration

    Swift

    public var columnWidth: [CGFloat]?
  • An array of percent width for each column.

    Set -1 for that column if it should have dynamic width. At most one column can be dynamic. For example, [0.2, -1, 0.4] means the width percent of first column is 0.2, width percent of third column is 0.4 and second column will take the remaining space available which is 0.4 in this case.

    Declaration

    Swift

    public var columnWidthPercent: [CGFloat]?
  • The spacing between two columns.

    Declaration

    Swift

    public var spacing: CGFloat
  • Boolean value to control to use grid table layout or object view layout in compact mode.

    Default value is false, using the object view layout in compact mode. The useColumnLayoutInCompact in the FUIGridTableViewCell need to be set correspondingly

    Declaration

    Swift

    public var useColumnLayoutInCompact: Bool
  • Type of the accessory view.

    Declaration

    Swift

    @IBInspectable
    open var accessoryType: UITableViewCellAccessoryType { get set }