Working on a iOS 26 navigation bar. How do I keep the titleView and subtitleView centered? Since the 'back-button' text is taking up space.

Asked on 2026-01-13

1 search

To keep the titleView and subtitleView centered in an iOS 26 navigation bar, especially when the 'back-button' text is taking up space, you can utilize the new features provided in iOS 26. According to the session Build a UIKit app with the new design, iOS 26 introduces more control over the title and large title areas in the navigation bar, including the addition of a new subtitle that is rendered below the title. You can use attributed strings for fine-grained adjustments to both the title and subtitle.

Here are some steps you can follow:

  1. Use Attributed Strings: This allows you to make fine adjustments to the positioning and styling of the title and subtitle.

  2. Custom Views: Specify custom views for the title and subtitle to add interactive elements and ensure they are centered.

  3. Flexible Spaces: Use flexible spaces with height to evenly distribute items in the navigation bar, which can help in centering the title and subtitle.

  4. Layout Margins: Lay out your custom view contents using the layout margins to get the correct spacing, ensuring that the title and subtitle remain centered even when the back button text is present.

By following these guidelines, you can maintain a centered appearance for your title and subtitle in the navigation bar.