gpt4 book ai didi

uitableview - UISearchController搜索栏隐藏tableview中的第一个单元格

转载 作者:行者123 更新时间:2023-12-04 03:57:42 26 4
gpt4 key购买 nike

我有一个带有搜索栏的tableview。搜索栏由UISearchController提供。当我将搜索栏添加到表格的标题 View 中时,表格的第一行将被搜索栏覆盖。

如何防止搜索栏隐藏第一行?

我在viewDidLoad中有以下代码段:

self.searchController = UISearchController(searchResultsController: nil)
self.searchController.searchResultsUpdater = self
self.searchController.searchBar.delegate = self
self.tableView.tableHeaderView = self.searchController.searchBar
self.searchController.dimsBackgroundDuringPresentation = false
self.searchController.searchBar.sizeToFit()

最佳答案

如果没有作用域按钮标题,则似乎必须显式设置作用域按钮标题数组。

self.searchController.searchBar.scopeButtonTitles = [NSArray array];

关于uitableview - UISearchController搜索栏隐藏tableview中的第一个单元格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30405321/

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