gpt4 book ai didi

ios - 如何在 iOS 中删除 UITableViewCell 的 No Result TableView?

转载 作者:塔克拉玛干 更新时间:2023-11-02 20:22:23 27 4
gpt4 key购买 nike

实际上我的 TableView 的背景颜色是黑色的。但是,当我使用 SearchBar 和搜索词时,如果没有匹配的数据,则会出现白色的“无结果”UITableView。如果没有匹配词,我不想出现带有“NO Result ” TableViewCell 的白色背景。我怎样才能删除那个白色的 UITableViewCell?

如果没有匹配的结果,我想删除 No Result TableView。 enter image description here

最佳答案

该 tableView 是自动出现的,因为它是搜索的一部分,但是您可以通过这样做进行修改:

  1. 创建一个名为 noResultsToDisplay(或其他名称)的 bool 标志。
  2. 如果没有要显示的结果,则设置 noResultsToDisplay = YES,否则设置为 NO
  3. numberOfRowsInSection 中,if (noResultsToDisplay) return 3;
  4. cellForRowAtIndexPath 中,if (noResultsToDisplay && indexPath.row == 2) cell.textLabel.text = @"No Results";

关于ios - 如何在 iOS 中删除 UITableViewCell 的 No Result TableView?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10178794/

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