tableFooterView property doesn't fix the footer at the bottom of the table view tableFooterView property doesn't fix the footer at the bottom of the table view ios ios

tableFooterView property doesn't fix the footer at the bottom of the table view


Since your goal is to have a footer that stays fixed at the bottom of the screen, and not scroll with the table, then you can't use a table view footer. In fact, you can't even use a UITableViewController.

You must implement your view controller as a UIViewController. Then you add your own table view as a subview. You also add your footer as a subview of the view controller's view, not the table view. Make sure you size the table view so its bottom is at the top of the footer view.

You will need to make your view controller conform to the UITableViewDataSource and UITableViewDelegate protocols and hook everything up to replicate the functionality of UITableViewController.


A footer view will always be added to the bottom of content.
This means that a section footer will be added below the cells of a section, a table footer view to the bottom of all sections - regardless of the position you set in your view.

If you want to add a "static" content, you should consider adding a view outside of the table view (superview) - which isn't possible if you use UITableViewController - or you use [self.table addSubView:view] and adjust the position/transform to the table view's contentOffset property in the scrollViewDidScroll: delegate method (UITableView is a subclass of UIScrollView so you also get it's delegate calls) like in this code:

@implementation YourTableViewController {    __weak UIView *_staticView;}- (void)viewDidLoad{    [super viewDidLoad];    // Do any additional setup after loading the view, typically from a nib.    UIView *staticView = [[UIView alloc] initWithFrame:CGRectMake(0, self.tableView.bounds.size.height-50, self.tableView.bounds.size.width, 50)];    staticView.backgroundColor = [UIColor redColor];    [self.tableView addSubview:staticView];    _staticView = staticView;    self.tableView.contentInset = UIEdgeInsetsMake(0, 0, 50, 0);}- (void)scrollViewDidScroll:(UIScrollView *)scrollView{    _staticView.transform = CGAffineTransformMakeTranslation(0, scrollView.contentOffset.y);}- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{    // this is needed to prevent cells from being displayed above our static view    [self.tableView bringSubviewToFront:_staticView];}...


Another way is to use UITableViewController in a storyboard, and embed it within a UIViewController as a container view. Then you can use auto layout to set the relationship between the footer and the container view which contains the UITableView