I've got a Master-Detail project using Xcode 7 beta 4 (Swift 2.1), where both the MVC and DVC are UIViewControllers. I have a UISearchController property in the DVC, which is used to display a UISearchBar in the titleView of the DVC nav controller. This search bar is working fine on iPad, but on iPhone, when I push the DVC, I can see the UISearchBar, but it cannot be tapped or first responder.
The odd thing is if I instantiate a local UISearchController in viewDidLoad and set its searchBar as the titleView, I can interact with the UISearchBar just fine, but every time I push the view controller, I get a warning:
"Attempting to load the view of a view controller while it is deallocating is not allowed - UISearchController"
If I create a class instance of the UISearchController by creating a DVC property, then the UISearchBar isn't interactable:
self.detailViewController?.navigationItem.titleView = self.searchController.searchBar
But if I do a local variable, it's interactable (with that warning stated above):
let localSearchController = UISearchController(searchResultsController: nil)
self.detailViewController?.navigationItem.titleView = localSearchController.searchBar
This bug has completely dumbfounded me, and it only occurs on iPhone. It seems like a simple problem, and I've tried many different approaches to figure it out. Maybe someone here has an idea what's wrong. Thanks!