How can I modify the appearance of 'empty' cells in plain UITableView?

前端 未结 8 2260
广开言路
广开言路 2020-12-08 21:18

If you have a plain (not grouped) UITableView with a single row, the rest of the screen is filled with blank or empty cells. How do you change the appearance of these blank

8条回答
  •  悲&欢浪女
    2020-12-08 21:41

    I believe the approach of using the UITableView tableView:viewForFooterInSection: method will not work for the case where the table is empty, ie., with no cells. In that case, you can use the technique Answerbot proposed can be repurposed to stuff the created UIView into the table's footer view explicitly, like the following:

        CGRect cellRect = CGRectMake(0, 0, table.bounds.size.width, table.bounds.size.height);
        CustomTiledView *footerView = [[[CustomTiledView alloc] initWithFrame:cellRect] autorelease];
        table.tableFooterView = footerView;
    

提交回复
热议问题