【问题标题】:How to hide UITableView Header and then have it Reappear?如何隐藏 UITableView Header 然后让它重新出现?
【发布时间】:2013-01-03 21:35:31
【问题描述】:

有时我的 UITableView 的一部分中没有包含任何单元格。在这种情况下,由于上部没有单元格,因此有两个相互重叠的标题。我正在尝试弄清楚如何暂时隐藏该上部标题,然后在我稍后返回该页面时让它重新出现。

我可以为-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section 返回零,然后以某种方式强制在 viewWillAppear 中再次调用它吗?

另外,如果我使用[self.tableView reloadData] 重新加载数据,你如何返回 UITableView Header 的标准高度?

【问题讨论】:

    标签: iphone ios ipad uitableview header


    【解决方案1】:

    当你必须隐藏标题时

    [tableView setContentOffset:CGPointMake(0, 44) animated:YES];
    

    当你必须显示标题时

    [tableView setContentOffset:CGPointMake(0, 0) animated:YES];
    

    【讨论】:

    • 如何让标题在 viewdidload 上消失?
    • [tableView setContentOffset:CGPointMake(0, 44) animated:YES];
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-10-22
    • 1970-01-01
    • 2011-05-06
    • 2013-05-13
    • 1970-01-01
    相关资源
    最近更新 更多