Search code examples
uikituinavigationbar

iOS 16 Beta Vertically Aligns Navigation Bar Title View Differently with Right Bar Items


On iOS 16, I noticed that the navigation bar title view is being aligned vertically to the top, I cannot figure out why. The odd thing is that some view controllers are fine (it's centered vertically). But some it's top aligned.

I thought maybe it had something to do with right/left bar button items, but after playing around with it - it doesn't seem to matter.

Is there some change in UIKit that is causing this?

Centered (In view controller A):

Centered

Top Aligned (In view controller B):

Top Aligned

My component is the same in all cases where this heart graphic is - it's a subclass of UIImageView that sets the image to the heart.

Additionally. The affected view controllers are the root view controller for navigation controller, that are in a tab bar controller.


Solution

  • I got a response from Apple:

    This is a bug where if you switch between the built in and custom title views we don't always update the layout correctly. I don't recall if there is a workaround, but this is fixed in a future build.

    It isn't fixed as of iOS 16 beta 7. Let's hope the GM is fixed.