gpt4 book ai didi

ios - UISearchController 重叠 TableView 的 ScrollView 。解决这个问题的最佳方法是什么?

转载 作者:行者123 更新时间:2023-11-30 12:14:31 26 4
gpt4 key购买 nike

刚刚完成 Ray Wenderlich 的“UI 搜索 Controller ”教程,其中我创建了一个带有范围按钮项的搜索栏:

https://www.raywenderlich.com/113772/uisearchcontroller-tutorial

我让它工作没有问题,除了范围按钮与我的 TableView ScrollView 的第一个结果重叠的小异常(exception):Picture Here

在我的应用程序中,我使用的是嵌入 UIViewController 内的 tableView,我猜这可能是问题所在。我在 UIViewController 上检查了“调整 ScrollView 插入”,但没有解决问题。即使尝试取消选中它,也可能是问题所在,但仍然不起作用。

我认为问题与教程中将 searchBar 添加为 tableView 的 headerView 相关:

 tableView.tableHeaderView = searchController.searchBar

但是,我不知道为什么它不会对看起来像 UINavigationController 的东西造成任何问题,但对于将其嵌入到 UITableViewController 内的 tableView 上的人来说却会造成问题。

非常感谢任何帮助/解决方法建议!提前非常感谢您。

编辑:实例化搜索 Controller 的代码,如下 Wenderlich 教程:

        searchController.searchBar.scopeButtonTitles = ["All","party", "hangout", "recreation", "event", "other"]
searchController.searchBar.tintColor = UIColor().crimson()

searchController.searchBar.delegate = self

//MARK: Search controller initialization
searchController.searchResultsUpdater = self
searchController.dimsBackgroundDuringPresentation = false

最佳答案

答案发现:在tableView中实现heightForHeaderInSection方法并返回高度。答案可以在这里找到:

https://stackoverflow.com/a/32996842/7389684

关于ios - UISearchController 重叠 TableView 的 ScrollView 。解决这个问题的最佳方法是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45596357/

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