UISearchController与UITableView重叠,这使我无法为单元格呈现详细的ViewController

时间:2016-04-30 05:28:10

标签: ios swift uitableview uiviewcontroller uisearchbar

我制作了UIViewController,其中包含UISearchControllerUITableView。 UITableView最初会显示所有结果,然后每当用户开始输入内容时,都会通过UISearchController进行过滤。单击每个单元格应链接到详细页面。虽然这在用户尚未开始输入时有效,但一旦用户开始输入,它就不再起作用,因此当UISearchController开始显示结果时。这就是我在控制台中得到的全部内容:

Warning: Attempt to present <MyProject.profileView: 0x13e9df000>  on <MyProject.SearchPage: 0x142a1d8f0> which is already presenting <UISearchController: 0x142a1f7c0>

这让我觉得UISearchController实际上是在第二个UITableView上显示过滤后的结果,我认为这应该是导致bug的原因。但是,我不完全确定。

这是我将UISearchController添加到UIViewController

的方法
searchController.searchResultsUpdater = self
searchController.dimsBackgroundDuringPresentation = false
self.definesPresentationContext = true
searchController.searchBar.scopeButtonTitles = ["Groups", "People"]
searchController.searchBar.delegate = self
tableView.tableHeaderView = searchController.searchBar

如果您知道可能导致此问题的原因和/或我怎么可能修复它,如果您能让我知道,我将非常感激。提前谢谢。

1 个答案:

答案 0 :(得分:0)

在坚持这个问题2周后,我发现解决方案实际上非常简单。我只需要从first define here In function `Z7qt_noopv': multiple definition of `operator>>(QDataStream&, scnent)` 而不是主UIViewController中展示UISearchController。这一行代码修复了它:

UIViewController