gpt4 book ai didi

iphone - 减少 UITableView 各部分之间的空间

转载 作者:IT王子 更新时间:2023-10-29 07:27:21 27 4
gpt4 key购买 nike

有没有办法减少 UITableView 的两个部分之间的空间?我拥有的每个部分之间大约有 15 个像素。我确实已经尝试为 -tableView:heightForFooterInSection:-tableView:heightForHeaderInSection: 返回 0,但这并没有改变任何东西。

有什么建议吗?

最佳答案

这有点棘手,但试试这个代码:

- (CGFloat)tableView:(UITableView*)tableView 
heightForHeaderInSection:(NSInteger)section {
if (section == 0) {
return 6.0;
}

return 1.0;
}

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

- (UIView*)tableView:(UITableView*)tableView
viewForHeaderInSection:(NSInteger)section {
return [[UIView alloc] initWithFrame:CGRectZero];
}

- (UIView*)tableView:(UITableView*)tableView
viewForFooterInSection:(NSInteger)section {
return [[UIView alloc] initWithFrame:CGRectZero];
}

相应地更改值。要删除空格,我认为 0.0 不会被接受。最小的合理值似乎是 1.0。

关于iphone - 减少 UITableView 各部分之间的空间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2817308/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com