警告:在意外状态下完成导航转换。使用" UISeachController"导航栏子视图树可能会损坏

时间:2016-02-29 21:29:39

标签: ios iphone uisplitviewcontroller uisearchcontroller

要想象 - 我已经在UINavigationController中嵌入了主视图控制器,并且在此视图控制器上安装了UISearchController。在包含搜索结果的表视图上执行搜索后,它会将用户分割到下一个视图控制器。然后按下后退按钮我收到此警告。这不会发生在iPad上,只有iPhone。更大的图片是UINavigationControllerUISplitViewController的详细视图控制器。

这是UISearchController

的实施
    func initializeSearchController() {
        searchController = UISearchController(searchResultsController: nil)
        writersTableView.tableHeaderView = searchController.searchBar
        searchController.searchBar.barTintColor = UIColor.whiteColor()

        searchController.searchBar.tintColor = UIColor.blackColor()
        searchController.searchBar.scopeButtonTitles = ["All", "Favorites"]
        searchController.searchBar.placeholder = "Search writers"

        searchController.searchResultsUpdater = self
        searchController.searchBar.delegate = self
        searchController.delegate = self

        definesPresentationContext = true
        searchController.dimsBackgroundDuringPresentation = false
        searchController.hidesNavigationBarDuringPresentation = true

        searchController.searchBar.sizeToFit()
        searchController.loadViewIfNeeded()
    }

然后还有另外一件事。我根据搜索结果行动态设置第二个视图控制器的标题,如下所示:title = writer.name - 后退按钮被重置为第二个视图控制器的标题值 - 以及标题& #39;在导航栏的中间'被遗漏了。 我想要的是后退按钮,第二个视图控制器标题动态变化。

如上所述,这不会发生在iPad上 - 只有iPhone?

0 个答案:

没有答案