[英]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.