Add button in tableview footer

后端 未结 3 1471
轻奢々
轻奢々 2021-02-19 07:18

I have tableview in one viewcontroller. I have one section in that. I want to add button in footer. I have written this code but footer view is not displaying.

-         


        
3条回答
  •  遇见更好的自我
    2021-02-19 07:42

    Be sure of three things

    1- You not implementing this method

    - (NSString *)tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section
    

    2- This method

    - (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{
    

    Is a UITableViewDelegate method and not UITableViewDataSource, Check if delegate of the tableview is set with the controller

    3- Be sure you are implementing this method

    - (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section;
    

    Finally, If everything is correct and still not working then You can just add the view in "tableFooterView" property of the table to be the footer of the whole table and not only the section

提交回复
热议问题