gpt4 book ai didi

ios - 在 TableView 末尾显示导航栏

转载 作者:行者123 更新时间:2023-11-29 03:44:47 25 4
gpt4 key购买 nike

导航栏不显示在表格 View 的末尾。我做错了什么?

- (void)tableView:(UITableView *)tableView didEndDisplayingCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath {
if([indexPath row] == [tableView numberOfRowsInSection: 0] - 1){
[self.navigationController setNavigationBarHidden:NO
animated:YES];
DDLogVerbose(@"Reached end of tableview");
}

}

“Reached end of tableview”输出到 Xcode,但导航栏(之前隐藏)不会重新出现。

我也尝试过使用 willDisplayCell 但它显示导航栏太早,就在最后一个单元格出现在屏幕上之前,这并不理想。

为什么即使输入了 if 语句,导航栏也不会重新出现在 tableview 的末尾?我该怎么做才能让它重新出现?


更新:大家的回答都很好,尽管如果有人可以向我解释为什么上面的代码不起作用,我也很感激。谢谢!

最佳答案

UITableView 是一个 UIScrollView,因此您可以使用其 scrollViewDidScroll: 委托(delegate)方法来决定,基于其 contentOffsetcontentSize,用于显示或隐藏任何内容。

关于ios - 在 TableView 末尾显示导航栏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17876640/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com