To make this short, I have a main view controller that has the navigation bar hidden, from that VC's navigation controller, I push another view controller which has the navigation bar visible. Then I add a searchController to the navigationItem to add the searchBar when I scroll down. Everything is working fine until you swipe back to pop the VC.
The navigation bar will animate leave the screen with the VC, but the searchBar will animate as if it's going up in place. What's worse is if I cancel the swipe to pop, the whole searchBar disappears and a black view appears instead (I think the searchController background ow whatever view background).
I tried everything, it's a few lines of code yet I've been pulling my hair to solve this. I know I can just disable swipe to pop but I don't want that(+ even when pressing back the searchBar animates in the same weird way) and I don't want to add a searchBar in any other way.
In the attached video I'm just swiping with my finger to show the animation.
- (void)viewDidLoad {
[super viewDidLoad];
self.definesPresentationContext = YES;
[self.navigationController setNavigationBarHidden:NO];
if (@available(iOS 11.0, *)) {
self.searchController = [[UISearchController alloc] initWithSearchResultsController:nil];
_searchController.delegate = self;
_searchController.searchResultsUpdater = self;
_searchController.searchBar.placeholder = @"Search";
self.navigationItem.searchController = _searchController;
self.navigationItem.hidesSearchBarWhenScrolling = YES;
}
}