Vla*_*kiy 49 objective-c uitableview ios
在iOS 6中,分组表视图似乎在底部有额外的填充(iOS 5没有它),但我找不到任何表明这是正确/预期行为的文档.
这也会影响示例项目,例如示例中的SimpleTableView
项目TableViewSuite
.我想我必须将样式AppDelegate
改为'分组',并将SDK更新到iOS 6,但没有对该项目进行其他更改.
调查显示,10px
保留了页眉和页脚视图,以及一些20px
无法解释的视图.没有实际的页眉或页脚视图(tableHeaderView
并且tableFooterView
正在nil
执行和返回nil
,例如viewForFooterInSection
什么都不做).我在tableView上找不到任何'20'值,虽然我可能错过了一些东西.
为页脚添加零大小视图不会做任何事情,但添加1px
方形视图会导致额外的填充消失.例如:
tableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectMake(0,0,1,1)];
Run Code Online (Sandbox Code Playgroud)
它确实占据了1px
高度,所以现在是底部填充11px
,但这远不如20那么明显.现在设置sectionFooterHeight
为0将仅1px
产生底部空间.
我的问题是:什么?我怎样才能完全删除它?这不是任务关键任务,但它非常奇怪,不可取,而且据我所知,它没有记录.
请注意 - 从Apple开发论坛复制过去的问题.但我有完全相同的问题,我也不明白如何解决它.
tou*_*bun 71
@frankWhite'解决方案效果很好,但这里有一个更好的解决方案,可以避免输入0.1,0.001或其他类型,以减少它的模糊性.
// Swift version
func tableView(tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
// remove bottom extra 20px space.
return CGFloat.min
}
Run Code Online (Sandbox Code Playgroud)
// Objective-C version
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
// remove bottom extra 20px space.
return CGFLOAT_MIN;
}
Run Code Online (Sandbox Code Playgroud)
an0*_*an0 31
您可以使用contentInset
补偿20px额外底部边距:
tableView.contentInset = UIEdgeInsetsMake(0, 0, -20, 0);
Run Code Online (Sandbox Code Playgroud)
zip*_*ppo 13
在Swift 3中
override func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
return CGFloat.leastNormalMagnitude
}
Run Code Online (Sandbox Code Playgroud)
fra*_*ite 11
-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
return 0.01;
}
Run Code Online (Sandbox Code Playgroud)
这对我有用
归档时间: |
|
查看次数: |
22974 次 |
最近记录: |