Update 2:
Since people are still looking at this question: know that I realized that it is impossible to reproduce this error on a real isolated iOS device. When you present the search controller, iOS also introduces a keyboard that spans the tab bar. To switch tabs, you must remove the keyboard, which will also reject the search controller.
The reason I say "isolated" is because I donβt know if you can play it using the Bluetooth keyboard and not try it. IOS keyboard cannot be presented with an external keyboard connected
Update:
I added viewWillDisappear to override View 1 and found interesting results:
If there is no search bar, switching tabs cancels the view before loading the next view. However, when the search bar is present, the view is NOT discarded before loading the next view.
I have a tab bar controller in the root that has 2 tabs. Each of them goes to the navigation controller, which puts the device into view mode. Here's a rough diagram:
/-> Navigation Controller -> View 1 tab bar controller \-> Navigation Controller -> View 2
This is working fine. However, View 1 has a UISearchController. The error is that if you click the search button, a search controller will be presented. If you then click View 2 on the tab bar and return to View 1, the search controller still exists and the view is black.
My current hacking βfixβ is to disable the tab bar when the search bar is obvious and turn it back on if the user selects βCancelβ. This has 2 problems:
- He twitches; the user should be able to switch tabs whenever he wants
- It only reactivates if the user clicks Cancel, and not if they just exit the search
How can i fix this? Here are photos of what I'm talking about




source share