Hi everyone,
I’m running into a strange issue with UISearchController placement with iOS 26 SDK. In one of my view controllers, I was able to move the search bar to the top of the navigation bar by setting:
navigationItem.searchController = searchController
navigationItem.hidesSearchBarWhenScrolling = false
navigationItem.preferredSearchBarPlacement = .stacked
This works as expected — the search bar is placed at the top.
However, in another view controller with almost identical configuration, the search bar always shows up at the bottom. If I delay the setup with DispatchQueue.main.async, it appears at the bottom; if I don’t, it doesn’t appear at all. Both VCs are wrapped in their own UINavigationController.
So my questions are:
- Has anyone faced this issue where preferredSearchBarPlacement = .stacked is ignored?
- Are there hidden requirements or limitations for placing the search bar at the top?
- Why could the same setup behave differently in two controllers?
Any help or ideas would be appreciated!