I have successfully pinned section headers in UICollectionView by setting sectionHeadersPinToVisibleBounds = true
for UICollectionViewFlowLayout
and subclassing UICollectionReusableView
. Is it possible to do something similar when working with Eureka's FormViewController
? My end goal is to have pinned section headers for each section.
I am using a custom Section by stying UIView like this: (Please note that the constrain block is from Cartography library)
private func createSection(title: String) -> Section {
let section = Section()
section.header = {
var header = HeaderFooterView<UIView>(.callback({
let view = UIView(frame: CGRect(x: 0, y: 0, width: self.tableView.bounds.width, height: 39))
let label = UILabel()
label.text = title
view.addSubview(label)
constrain(view, label) { view, label in
label.left == view.left + 16
label.bottom == view.bottom - 8
label.right == view.right - 16
}
return view
}))
header.height = { 39 }
return header
}()
return section
}