UITableView extra space at bottom

后端 未结 11 578
被撕碎了的回忆
被撕碎了的回忆 2020-12-15 20:15

My tableview has an extra space at the bottom, as you see in the picture:

All the rows in the tableView have a fixed height of 71pt.

11条回答
  •  南方客
    南方客 (楼主)
    2020-12-15 20:38

    in this case you can give tableview the bottom space 0 to its superview and it will work i think or you can do,

    tableView.tableFooterView = UIView();

    or you can do like below,

    The lower value should be 1.0.

    - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger )section {
        if(section == 0) {
           return 6;
        } else {
           return 1.0;
        }
    }
    
    - (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger )section {
        return 5.0;
    }
    
    - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger )section {
        return [[UIView alloc] initWithFrame:CGRectMake(0, 0, 0, 0)];
    }
    
    - (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger )section {
        return [[UIView alloc] initWithFrame:CGRectMake(0, 0, 0, 0)];
    }
    

提交回复
热议问题