iPad SearchBar suddenly moved from centered low to the right of rightBarButtons

App build with latest Xcode latest MacOS, deployment is iOS 14.

It seems that in one App update, the search bar moved from centered low near the bottom of the NavigationBar to the right of the rightBarButtons. Previously we saw this:

Now we get this with the exact same code:

I dug around the UINavigationItem documentation, and there is a new property that lets you set the preferred placement:

    if (@available(iOS 16.0, *)) {
        navigationItem.preferredSearchBarPlacement = UINavigationItemSearchBarPlacementStacked;
    }

That restore what our users use to see. But it will only work if the user is on iOS 16 - is there someway to get the old behavior on iOS 14+?

We directly set the navItem's searchBar: navigationItem.searchController = searchController

David

PS: I have to believe something changed in the iOS frameworks that caused this - our code hasn't changed in this area for years.

Accepted Reply

You'll automatically get the old behavior on iOS <16 because the new behavior only exists on iOS 16+ (and only when you've adopted the iOS 16 SDK).

  • Thanks! It occurred to me after posting this might be the case. But why Apple is the default in ios16 different than the past? Lots of ****** off customers…

Add a Comment

Replies

You'll automatically get the old behavior on iOS <16 because the new behavior only exists on iOS 16+ (and only when you've adopted the iOS 16 SDK).

  • Thanks! It occurred to me after posting this might be the case. But why Apple is the default in ios16 different than the past? Lots of ****** off customers…

Add a Comment