UITableView: the proper way to display a separator for the last cell

后端 未结 14 1030
礼貌的吻别
礼貌的吻别 2020-12-29 02:23

The question is what\'s the right-most way to display a separator in the last cell in a table/section.

Basically this is what I am after.

14条回答
  •  死守一世寂寞
    2020-12-29 03:00

    If you add an empty footer then the tableview will remove all the remaining line separators (for non-existent cells) but will still include the separator for the last cell:

    - (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
    {
        return [UIView new]; 
    }
    

提交回复
热议问题