Skip to content

Commit

Permalink
fixes footer and header heights on ios 11 to be automatic dimension i…
Browse files Browse the repository at this point in the history
…f the view returns as 0 (#109)
  • Loading branch information
rhaining authored Aug 28, 2017
1 parent 2071110 commit 319a8b8
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions Static/DataSource.swift
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,13 @@ extension DataSource: UITableViewDataSource {
}

public func tableView(_ tableView: UITableView, heightForHeaderInSection sectionIndex: Int) -> CGFloat {
return section(at: sectionIndex)?.header?.viewHeight ?? 0
guard let headerView = section(at: sectionIndex)?.header else { return 0 }

var headerHeight = headerView.viewHeight
if headerHeight == 0 {
headerHeight = UITableViewAutomaticDimension
}
return headerHeight
}

public func tableView(_ tableView: UITableView, titleForFooterInSection sectionIndex: Int) -> String? {
Expand All @@ -216,7 +222,13 @@ extension DataSource: UITableViewDataSource {
}

public func tableView(_ tableView: UITableView, heightForFooterInSection sectionIndex: Int) -> CGFloat {
return section(at: sectionIndex)?.footer?.viewHeight ?? 0
guard let footerView = section(at: sectionIndex)?.footer else { return 0 }

var footerHeight = footerView.viewHeight
if footerHeight == 0 {
footerHeight = UITableViewAutomaticDimension
}
return footerHeight
}

public func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool {
Expand Down

0 comments on commit 319a8b8

Please sign in to comment.