How to add a footer to the UITableView?

前端 未结 11 1924
没有蜡笔的小新
没有蜡笔的小新 2020-11-29 04:23

I\'me using this code to add a footer to the TableView. It has 20 sections, and each section a few rows. There\'s a titleForHeaderInSection, and sectionForSectionIndexTitle

相关标签:
11条回答
  • 2020-11-29 04:59

    instead of

    self.theTable.tableFooterView = tableFooter;
    

    try

    [self.theTable.tableFooterView addSubview:tableFooter];
    
    0 讨论(0)
  • 2020-11-29 05:00
    [self.tableView setTableFooterView:footerView];
    
    0 讨论(0)
  • 2020-11-29 05:01

    I had the same problem but I replaced the following line in my header:

    @interface MyController : UIViewTableViewController <UITableViewDelegate, UITableViewDataSource>
    

    with this line and it works as expected:

    @interface RequestViewController : UIViewController <UITableViewDelegate, UITableViewDataSource>
    

    Notice the UIViewController. Good luck :)

    0 讨论(0)
  • 2020-11-29 05:08

    I'm specifically seeing in my code that

    self.theTable.tableFooterView = tableFooter;
    

    works and

    [self.theTable.tableFooterView addSubview:tableFooter];
    

    does not work. So stick to the former and look elsewhere for the possible bug. HTH

    0 讨论(0)
  • 2020-11-29 05:10

    If you don't prefer the sticky bottom effect i would put it in viewDidLoad() https://stackoverflow.com/a/38176479/4127670

    0 讨论(0)
提交回复
热议问题