Thank you for your reply.
I managed to resolve the issue with:
navigationItem.preferredSearchBarPlacement = .stacked
My goal was to keep the search bar integrated into the navigation bar, as it used to be prior to iOS 26.
However, with my layout I’m forced to configure both the search bar and the search controller during the view controller’s initialization.
Otherwise, system methods override these settings and the search bar ends up being placed in the bottom toolbar. In some cases, when configuring in viewDidLoad, the search bar would not appear at all — the only workarounds were to configure it in viewWillAppear or wrap the setup in DispatchQueue.main.async.
This might be the intended behavior, but if something is off on my side, I hope these observations can still be useful.
For context: the layout is relatively simple — the view controller is embedded in a UINavigationController, and the one containing the search bar consists of a UIStackView + UITableView. Three similar view controllers are placed inside a paged UIScrollView, and I navigate between them either with gestures or programmatically using scrollTo:.
Topic:
UI Frameworks
SubTopic:
UIKit
Tags: