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