Can I use autolayout for sizing section headers? Setting header.height to nil doesnt seem to work.
Is there a reason that you support autosizing cells and dont support autosizing headers?
Is there a way to force layout of the actual view in the header.height closure (without keeping another instance of the same view for layout purposes)?
Section { s in
var header = HeaderFooterView<MyFormSectionHeaderView>(.Class)
header.onSetupView = { v, _, _ in
v.label.text = "Description"
}
header.height = { /*use autolayout to layout 'v' from onSetupView */ 42 }
s.header = header
}
You can do it by returning UITableViewAutomaticDimension
for the header footer height....
Section() {
var header = HeaderFooterView<EurekaLogoViewNib>(HeaderFooterProvider.NibFile(name: "EurekaSectionHeader", bundle: nil))
header.onSetupView = { (view, section, form) -> () in
// ..
}
header.height = { UITableViewAutomaticDimension }
$0.header = header
}
You have also to set up estimatedSectionHeaderHeight
and estimatedSectionFooterHeight
...
override func viewDidLoad() {
super.viewDidLoad()
tableView?.estimatedSectionHeaderHeight = 20
tableView?.estimatedSectionFooterHeight = 20
Let me know if this works in your app...
Check out issue #134. It should be helpful.
it doesn't work
Most helpful comment
You can do it by returning
UITableViewAutomaticDimension
for the header footer height....You have also to set up
estimatedSectionHeaderHeight
andestimatedSectionFooterHeight
...Let me know if this works in your app...