gpt4 book ai didi

ios - UISearchController 不想出现,因为他不在 View 层次结构中

转载 作者:可可西里 更新时间:2023-11-01 03:45:30 24 4
gpt4 key购买 nike

我正在尝试使用 UISearchController 在我的 UITableViewController 中进行搜索。对于入门项目,我使用 Apple's example .我做了一些更改,我想使用一个类而不是示例中的你。我正在从代码中添加我的 UISearchController。我的问题是由于异常我无法调用 UISearchController :

2015-06-18 13:35:04.750 TableSearch[4796:77813] Warning: Attempt to present <UISearchController: 0x7fe09b719f00> on <APLMainTableViewController: 0x7fe09b50e450> whose view is not in the window hierarchy!

Working project with changes

有人可以告诉我我做错了什么吗?谢谢!

最佳答案

更新的答案:

    self.searchController = [[UISearchController alloc] initWithSearchResultsController:nil];

对于那些想要带有搜索结果的工作示例的人,请参阅我的存储库 https://github.com/Optimbyte/IOSVC-master

旧答案:我想你忘了在 MainStoryBoard 中添加一个搜索栏和搜索显示 Controller 。 required

关于ios - UISearchController 不想出现,因为他不在 View 层次结构中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30913223/

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