Monday, March 28, 2016

Warning: Finishing up a navigation transition in an unexpected state. Navigation Bar subview tree might get corrupted with “UISeachController”

Leave a Comment

To visualize - I've got the main view controller embedded in a UINavigationController and on this view controller the UISearchController is installed. After performing the search tapping a row on the table view containing the search results, it segues the user to the next view controller. Then on pressing the back button I get this warning. This doesn't happen on the iPad, only iPhone. The bigger picture is that the UINavigationController is the detail view controller of a UISplitViewController.

This is the implementation of the 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()     } 

Then there is another thing. I set the title of the second view controller dynamically according to which search result row is tapped like this: title = writer.name - The back button gets reset to whatever the value of the title of the second view controller is - and the title 'in the middle of the navigation bar' is left out blank. What I would like to have is the back button as it is and the second view controller title changes dynamically.

As indicated this doesn't happen with the iPad - Only iPhone?

0 Answers

If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment