Search code examples
iosxcodeuitableviewinterface-buildertablefooterview

Adding UIView to TableViewfooter isn't fully visible


I have a xib file with a table view and I want to simple add a UIView with a button inside of it and make that my table view footer view. The height of the UIView (and the button is 50) and setting the section height to match that in IB doesn't seem to help but in the end it seems as if only half of the button is showing and the bottom part of the tableview isn't being shown(i.e. the separator line for the second cell is not visible..see screenshots).

Was wondering if you could help figuring out what the problem is? In the below screenshots you will see the code where I add the view to the footer view in code, a screenshot of interface builder and a screenshot of what is happening on the device. In the code, the UIView with the button inside have an outlet that i am referencing. This UIView has a height of 50 and i set the section height to be 50. Currently I am not implementing any section tableview delegate methods. Don't know that this is needed here.

enter image description here enter image description here enter image description here enter image description here


Solution

  • If you would like the tableView to take up the entire screen, you must set it's frame to take up the entire screen. A tableView's contentSize will grow automatically, but it's frame will not. There is no provided separator between tableFooterView's and it's preceding row. You don't need to set the height of the sectionFooter; a tableFooterView is distinct from a sectionFooterView as it appears at the bottom of the table and not at the end of a section.