Space Between Sections in UITableview

前端 未结 11 2190
醉酒成梦
醉酒成梦 2020-12-08 12:37

I need to reduce the space between two sections ofUITableView. I looked at this question but the solution doesn\'t allow for my custom header view because it c

11条回答
  •  盖世英雄少女心
    2020-12-08 13:15

    You can do it by implement the delegate heightForHeaderInSection & heightForFooterInSection.

    The return vaule should not be 0, even if the SectionHeader or the height of SectionFooter is 0, it need a very small value, try CGFLOAT_MIN.

    for my example:

    - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    if (section == [self.dataArray indexOfObject:self.bannerList]) {
        return 46;
    }
    return CGFLOAT_MIN;
    

    }

    - (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
        return CGFLOAT_MIN;
    } 
    

提交回复
热议问题