我正在尝试使用UISearchController在我的UITableViewController中进行搜索.对于初学者项目,我使用
Apple’s example.
我做了一些更改,我想在示例中使用一个类而不是你.我从代码中添加我的UISearchController.我的问题是我因为exeption而无法调用UISearchController:
我做了一些更改,我想在示例中使用一个类而不是你.我从代码中添加我的UISearchController.我的问题是我因为exeption而无法调用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中添加一个搜索栏和搜索显示控制器.