I've a UISearchController in FirstViewController's navigationItem. And the same in a SecondViewController and I push SecondViewController from FirstViewController.
When the user slides to go back, the below UI glitch is visible.
The area containing the UISearchController becomes dim. If the user goes back to FirstViewController, it looks good. But if the user stays in the SecondViewController after sliding a little, then this is what it looks like.
The space which had the searchController is now empty. If the user scrolls up or down, the searchController becomes visible again.
Options tried to fix the issues
- using
UITableViewControllerinstead ofUIViewControllerwithUITableView - toggling
navigationItem.hidesSearchBarWhenScrollingproperty inviewDidLoadandviewWillAppear - setting
navigationItem.searchControllerasnilinviewWillDisappear
Apart from this issue, when I use UITableView inside a UIViewController, the searchController hides under the title and comes out at a slightly high speed than the native apps like Messages, Mail.
And when I use UITableViewController, the animation is smooth but the searchController gets struck halfway if the user does not slide up or down fully, like shown below. This happens both with and without large titles.
My usecase can also be achieved, if someone can answer this question.
UPDATE:
setting extendedLayoutIncludesOpaqueBars as true in SecondViewController did resolve the issue. But there is a slight unwanted jerk in the tableview, if the user slides to go back but then changes his/her mind.



