gpt4 book ai didi

ios - 在 UITableView 顶部显示消息

转载 作者:行者123 更新时间:2023-11-28 23:01:54 25 4
gpt4 key购买 nike

我有一个 UITableView,它由 NSFetchedResultsController 支持。我想在列表顶部显示一条消息,例如“显示按 XYZ 过滤的项目”。我尝试在 IB 的屏幕顶部插入一个带有 UILabelUIView,但它似乎不起作用。这甚至可以做我想做的事吗?

最佳答案

如果您不在表格 View 上使用标题,您可以在 UITableView 的顶部添加一个自定义标题。

实现这个方法:

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {

UIView *myCustomView = [UIView alloc] init];
//Add your label on myCustomView

return myCustomView;

}

关于ios - 在 UITableView 顶部显示消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9856399/

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