Navigation Bar doesn't alway vertically center buttons and title text in the bar?

23 views Asked by At

I am upgrading an app from iOS 12 to iOS 14.5. The app has a navigation bar. When I run it in the Simulator on an iPhone SE (2nd gen), 8, 8+ or iPod (7th gen) the navigation bar correctly displays the buttons and title text as vertically centered in the bar. However when I run it in the simulator on any iPhone 11, 11 Pro, 11 Max, 12, 12 Mini, 12, 12 Pro, 12 Pro Max the navigation bar displays the buttons and title text at the bottom of the navigation bar?

See the 2 example images below.

enter image description here

enter image description here

I can implement:

    func setTitleVerticalPositionAdjustment(_ adjustment: CGFloat, 
                                for barMetrics: UIBarMetrics)

but that doesn't affect the navigation buttons, plus it knocks the title text out of vertical center for iPhone SE, 8, 8+ and iPod, and the compiler complains about "Unable to simultaneously satisfy constraints."

Implementing:

    func setBackgroundVerticalPositionAdjustment(_ adjustment: CGFloat, 
                                     for barMetrics: UIBarMetrics)

doesn't affect the vertical centering of the navigation bar buttons.

Any help would be appreciated!

0

There are 0 answers