首页 文章

减少UITableView中单元格之间的空间 - 为什么这个代码不会这样做?

提问于
浏览
0

任何想法为什么我不能减少/删除Grouped UITableView中的单元格之间的空间(每个部分一个单元格) . 我在控制器中包含以下内容:

- (CGFloat) tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
    return 0.0;
}

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

即使使用此代码,我仍然在单元格之间获得空格 . 在细胞周围放置边框,空间不是来自细胞本身 .

1 回答

  • 0

    根据PengOne的建议来查看答案here,我没有使其成功的原因如下:

    -(UIView*)tableView:(UITableView*)tableView viewForHeaderInSection:(NSInteger)section
    {
        return [[[UIView alloc] initWithFrame:CGRectMake(0, 0, 0, 0)] autorelease];
    }
    
    -(UIView*)tableView:(UITableView*)tableView viewForFooterInSection:(NSInteger)section
    {
        return [[[UIView alloc] initWithFrame:CGRectMake(0, 0, 0, 0)] autorelease];
    }
    

相关问题