ra1028 / Carbon

🚴 A declarative library for building component-based user interfaces in UITableView and UICollectionView.

Home Page:https://ra1028.github.io/Carbon

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Stick a component to the bottom of a UITableView

valzevul opened this issue · comments

Checklist

Expected Behavior

Being able to set AnyComponent or ViewNode as tableView.tableFooterView so it always sticks to the bottom no matter how many cells are displayed.

Current Behavior

Seems like currently there is no way to set a footer of the whole table view, only within a section:

renderer.render {
      Section(
        id: "XXX",
        cells: [
          ...,
         ...
        ],
       footer: <FOOTER>
      )
}

Detailed Description (Include Screenshots)

Thanks a lot for the framework. I was curious whether there is way to attach a view to the bottom of the screen using ViewNode or AnyComponent irregardless of the number of displayed cells (so the spacing between this component and BottomLayoutGuide is always fixed).

Environment

  • Carbon version:
    1.0.0-rc.5
  • Swift version:
    5.0
  • Xcode version:
    11.1

Hi @valzevul ,
Can you use UITableView style grouped?
Otherwise, use another section just for a footer component is one way.

renderer.render {
    Section(id: "Section for your awesome UI") {
        Cell()
        Cell()
    }

    Section(id: "Section for footer") {
        Footer()
    }
    // or `Section(id: "Section for footer", footer: Footer())`
}