相关疑难解决方法(0)

当我开始搜索时,UISearchController中的UISearchBar消失了.为什么?

这就是我设置我的方式 UIsearchController

private func setupSearchController() {
    let searchResultsController = storyboard!.instantiateViewControllerWithIdentifier(DBSearchOptionControllerIdentifier) as! DBSearchOptionController

    searchController = UISearchController(searchResultsController: searchResultsController)

    let frame = searchController.searchBar.frame
    searchController.searchBar.frame = CGRectMake(0, 50, view.bounds.size.width, 44.0)
    searchController.searchResultsUpdater = self
    view.addSubview(searchController.searchBar)
    searchController.searchBar.text = "mmm"
    view.bringSubviewToFront(searchController.searchBar)
    searchController.searchBar.bringSubviewToFront(view)

}
Run Code Online (Sandbox Code Playgroud)

这是我初始化后的看法UISearchController:

在此输入图像描述

这是我开始在UISearchBar中输入时的样子:

在此输入图像描述

为什么我的搜索栏会消失?

这非常有趣,因为现在当我停止应用程序时,你可以看到它确实在那里:-)那么为什么它不可见?

在此输入图像描述

uisearchcontroller

5
推荐指数
1
解决办法
793
查看次数

标签 统计

uisearchcontroller ×1