I am trying to incorporate auto layout into my UITableViewHeaderFooterView subclass. The class is pretty basic, just two labels. This is the complete subclass:
In iOS 11 I just could not get UITableViewHeaderFooterView
to display correctly.
The problem was that I was setting my constraints when the UITableViewHeaderFooterView
thought it's bounds were empty so it would always cause conflicts.
Here's the solution
override func layoutSubviews() {
super.layoutSubviews()
guard bounds != CGRect.zero else {
return
}
makeConstraints()
}