有没有办法减小UITableView的两个部分之间的空间?我拥有的每个部分之间大约有15个像素.我已经try 为-tableView:heightForFooterInSection:-tableView:heightForHeaderInSection:返回0,但这不会改变任何事情.

有什么建议吗?

推荐答案

这有点棘手,但请try 以下代码:

- (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.

Ios相关问答推荐

设置堆栈视图的所有属性

UITableViewCell编程约束问题

flutter中实现自定义底部导航栏

如何解决错误 HE0004:无法在 Visual Studio 2022 中加载框架ContentDeliveryServices

如何在 SwiftUI 视图中显示协议视图?

占位符文本未显示在 TextEditor 上

叠加视图不在堆栈中维护自身 - SwiftUI

如何在 SwiftUI 的 TabView 中添加底部曲线?

在所有 tableview / collectionview 中禁用滚动指示器

类型任何视图不能符合具有泛型的协议上的视图

如何在字段包含字典数组的firestore上查询?

在设备上卸载 ios 应用程序后如何在 ios 中保留 identifierForVendor?

获取 iOS 上所有联系人的列表

判断可选数组是否为空

Xcode 8:函数类型不能有参数标签 destruct 我的构建

iOS Swift - 获取当前本地时间和日期时间戳

为所有 UIImageViews 添加圆角

自动布局:是什么创建了名为 UIView-Encapsulated-Layout-Width & Height 的约束?

比较没有时间分量的 NSDates

由于 GoogleSignIn、AdMob 提交应用程序时 iOS 10 GM 发布错误应用程序try 在没有使用说明的情况下访问隐私敏感数据