How to hide a section in UITableView?

前端 未结 12 2187
梦如初夏
梦如初夏 2020-12-05 00:32

There are some section in the table that does not contain any data and would like to hide that section.

How to do this?

12条回答
  •  北海茫月
    2020-12-05 01:17

    Try like this:-

    - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
    {
        CGFloat headerHeight=10.f;
        if (section==0)
        {
            headerHeight=0.01f;
        }
        else
        {
            headerHeight=50.0f;
        }
        return headerHeight;
    }
    

提交回复
热议问题