我以footerview
编程方式为每个部分添加如下。我可以看到footerview
.
但是,当我在表格视图的底部或顶部向上或向下滚动时,会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;
}
滚动前
滚动后