请注意,我将在这个问题中将点称为像素。
我有一个包含 3 个部分的分组 UITableView
,每个部分都有一个 40 像素高的标题 View 。表格 View 中的第一个标题似乎被系统赋予了 35 像素的 y 位置。
我试过使用 automaticallyAdjustsScrollViewInsets
和其他一些 iOS 7 自动组件,但无济于事。
为什么我的 UITableView
内容被插入了 35 像素?
编辑:我见过this answer以及许多其他主题。我有有效的标题和标题高度。此外,将默认值设置为 FLT_MIN
、0.01f、1.0f 或 100.0f 也无法解决问题。
这是我的标题实现:
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
UIView *header = (self.headerViews.count > section ? self.headerViews[section] : nil);
return (header.viewHeight ? : FLT_MIN);
}
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
UIView *header = (self.headerViews.count > section ? self.headerViews[section] : nil);
return (header.viewHeight ? header : nil);
}
我也在设置:
- (BOOL)automaticallyAdjustsScrollViewInsets{return NO;}
和
[self setSectionHeaderHeight:FLT_MIN];
最佳答案
似乎是这样的:
[self setTableHeaderView:[[UIView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, width, FLT_MIN)]];
在 init 中,self
是一个 UITableView
,将去掉前 35 个点。
关于ios - 分组的 UITableView 35 点/像素顶部插图/填充,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23663947/