对于UISearchController,我很新,所以如果这是一个愚蠢的问题,请原谅。UISearchController:searchResultsController not displayed
我试过以下this的问题,但无法得到我想要的结果。
在我MapViewController's
viewDidLoad
我初始化搜索控制器像这样:
searchController = UISearchController(searchResultsController: customViewController)
其中customViewController是一些文本标签的子类的UIViewController现在(通过界面生成器)。 (I声明它像这样:let customViewController = MyCustomeViewController()
我试图通过隐藏并在委托方法没有运气searchController.searchResultsController?.view.isHidden = false
取消隐藏的searchResultsController
按照上述链接
结果是相同的:其中仅视图变暗。
理想我希望它是类似于Facebook的应用一些地方,当你点击搜索栏它显示了不同的看法。
我打印的searchResultsController
对象在委托willPresentSearchController
并且它确实表示它为MyCustomViewController
。
我在这里错过了什么,或者这不是正确的做法?