0
我已经按编程方式为每个部分添加了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;
}
滚动之前
后滚动
你的'heightForFooterInSection'返回的高度是多少? 60还是0? – Paulw11
如果有'footerview',它是'60'。如果不是,那么它是'0'基于'if(adminOrderElements [section] .expanded && [adminOrderElements [section] .notes length]> 0)' – hotspring
我会建议在你正在返回的零件上添加一个断点0并检查它是否去那里,我认为你不需要第二次返回60声明 – 3stud1ant3