iPadOS 18 - Move Tab Bar to bottom

As iPadOS 18 shows Tab Bar on top (tvOS'esq), can someone please tell me what changes do I need to make to get tab bar shown as a regular one (Pre iPadOS 18 style)?

  • Tab bar being at the bottom is easily accessible. And, it being on top needs too much of hands movement.
  • That being on top is is occupying, in a way, more screen real estate.

Any ideas appreciated. Thank you.

Answered by DTS Engineer in 803316022

@guyfromnrt There isn't a recommended approach or API that reverts the TabView style. Please file an enhancement report asking for this behavior using Feedback Assistant and paste the FB number here.

You can override the horizontal size class to .compact. The solution is so-so, but I haven't found a better one yet.

Example:

TabView {
...
}
.environment(\.horizontalSizeClass, .compact)

@guyfromnrt There isn't a recommended approach or API that reverts the TabView style. Please file an enhancement report asking for this behavior using Feedback Assistant and paste the FB number here.

Using the modifier
.environment(\.horizontalSizeClass, .compact) does work but it disables NavigationSplitView code so, if you only have Stack Views in your app, it’s fine; however, it’s not a viable option for me. I’m losing half of an active Search Bar (including its Cancel Button) under the left hand edge of a Tab Bar in Portrait orientation. The Search Bar sits below the Navigation Bar in Portrait orientation, avoiding any conflict with the Tab Bar, until it is activated. I wish it stayed put!

class CustomTabBarController: UITabBarController { override func viewDidLoad() { super.viewDidLoad()

    guard #available(iOS 18, *), UIApplication.shared.isPad else {
        return
    }
    
    // Setting the horizontal size class will force the tab bar
    // to be displayed at the bottom.
    traitOverrides.horizontalSizeClass = .compact
}

}

traitOverrides.horizontalSizeClass = .compact

Works but not if you want to see more than 4 tabs at the bottom.

traitOverrides.horizontalSizeClass = .unspecified

Works if you want to see more than 4 tabs at the bottom.

iPadOS 18 - Move Tab Bar to bottom
 
 
Q