[英]Footer overlays on top of tableview cell contents while scrolls
我footerview
编程方式为每个部分添加了footerview
,如下所示。 我能够看到footerview
。
但是,当我向上或向下滚动到tableview的底部或顶部时, footerview
覆盖tableviewcells
顶部。
如何禁用它?
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
{
if(adminOrderElements[section].expanded && [adminOrderElements[section].notes length]>0)
{
return 60;
} else {
return 0;
}
return 60;
}
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
{
UIView *footer = [[UIView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 60)];
footer.backgroundColor = [UIColor clearColor];
UILabel *lbl = [[UILabel alloc]initWithFrame:footer.frame];
lbl.backgroundColor = [UIColor clearColor];
lbl.text = @"Your Text";
lbl.textAlignment = NSTextAlignmentCenter;
[footer addSubview:lbl];
return footer;
}
滚动前
滚动后
如果我没有理解你的问题,你只需要改变UITableViewStyle
到UITableViewStyleGrouped
。 根据文档 ,对于使用分组样式的表视图,节的页眉和页脚不会浮动 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.