tableView Section头部停留在顶部
当UITableView的style为Plain的时候,就会出现这种情况,解决办法就是创建的时候选择组的形式
_tableView = [[UITableView alloc]
initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH,self.view.frame.size.height - 64)
style:UITableViewStyleGrouped];
组的形式会有默认高度
如何去掉header和footer的高度,你只需要组头时就记得设置组尾为0.1
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
{
return 0.1;
}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
return 0.1;
}

本文主要介绍了在UITableView中,如何处理Section头部固定在顶部的问题,以及如何去除组尾的默认高度。通过设置Section头部样式,并在创建时选择适合的组形式,可以实现Section头部的固定。同时,设置组尾高度为0.1可以去除footer的高度。
3376

被折叠的 条评论
为什么被折叠?



