Skip to content

Instantly share code, notes, and snippets.

@GantMan
Created September 15, 2014 20:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GantMan/66dd57663a35d4e070d5 to your computer and use it in GitHub Desktop.
Save GantMan/66dd57663a35d4e070d5 to your computer and use it in GitHub Desktop.
collapse table section when no data
# requires earlier use of self.tableView.sectionHeaderHeight = 0
# + this
def tableView(table_view, heightForHeaderInSection:section)
# nasty hack to hide empty section
if @data[section].empty?
0
elsif @data[section - 1].empty? #squeeze follow up section
20
else
30
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment