Skip to content

Commit c8d7c1a

Browse files
committed
height calculations fix
1 parent 4cb8bae commit c8d7c1a

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

LayoutOps/LayoutOps/UIKit/TableViewNodesDisplayAdapter.swift

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,13 @@ public final class TableViewNodesDisplayAdapter {
4343
}
4444

4545
public func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
46-
return footerNodeSequence.size(for: section, size: CGSize(width: tableView.bounds.size.width, height: 0)).height
46+
let h = footerNodeSequence.size(for: section, size: CGSize(width: tableView.bounds.size.width, height: 0)).height
47+
48+
if isAlmostEqual(left: h, right: 0) {
49+
return CGFloat.leastNormalMagnitude
50+
} else {
51+
return h
52+
}
4753
}
4854

4955
public func tableView(_ tableView: UITableView, willDisplayFooterView view: UIView, forSection section: Int) {
@@ -57,7 +63,13 @@ public final class TableViewNodesDisplayAdapter {
5763
}
5864

5965
public func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
60-
return headerNodeSequence.size(for: section, size: CGSize(width: tableView.bounds.size.width, height: 0)).height
66+
let h = headerNodeSequence.size(for: section, size: CGSize(width: tableView.bounds.size.width, height: 0)).height
67+
68+
if isAlmostEqual(left: h, right: 0) {
69+
return CGFloat.leastNormalMagnitude
70+
} else {
71+
return h
72+
}
6173
}
6274

6375
public func tableView(_ tableView: UITableView, willDisplayHeaderView view: UIView, forSection section: Int) {

0 commit comments

Comments
 (0)