簡體   English   中英

滾動時頁腳疊加在tableview單元格內容的頂部

[英]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;
}

滾動前

在此處輸入圖片說明

滾動后

在此處輸入圖片說明

如果我沒有理解你的問題,你只需要改變UITableViewStyleUITableViewStyleGrouped 根據文檔 ,對於使用分組樣式表視圖,節的頁眉和頁腳不會浮動

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM