删除表视图中第一行顶部的空格

时间:2014-01-18 09:23:53

标签: ios objective-c uitableview ios6 ios7

在我的应用程序中,我在表格视图中使用自定义单元格来显示所有行中的图像。但是在我的.xib文件中,自定义单元格的顶部有一个很大的空白区域。任何人都可以告诉我如何删除iOS7(iPad)中的空间? (比如如何更改自定义单元格的Y轴)

3 个答案:

答案 0 :(得分:2)

这是IOS7与UITableViewStyleGrouped相关的问题,以及部分页脚视图的大小。

如果将footerView设置为0,则默认为更大的值。我找到的解决方案是将页脚设置为非常小的非零数

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

答案 1 :(得分:0)

尝试像这样设置你的属性检查器..

enter image description here

答案 2 :(得分:0)

这可能会对您有所帮助:

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {

        UILabel *sectionHeader = [[UILabel alloc] initWithFrame:CGRectNull];
        sectionHeader.hidden = YES;
        return sectionHeader;    
}

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

有时,第一行中的空白区域是节标题空间。这个功能消除了它。

相关问题