Search code examples
ios11

iOS 11 UINavigationBar bar button items alignment


I am upgrading my application to iOS 11 and I am seeing some problems with the navigation bar, part of my problems have already asked questions here, so I won't mention them in this question.

The particular problem in question is that the navigation bar's bar button items are spaced differently. My main left and right bar button items are closer to the screen's horizontal center now and I can't move them near to the screen edges. In the past I have used a custom UIButton subclass and created bar button items with custom view. The alignment solution were alignmentRectInsets and contentEdgeInsets, now I couldn't manage to produce the expected results using this approach.

Edit:
I have retested with iOS 11 beta 2 and the issue remains.

Edit 2: I Have retested with iOS beta 3 and the issue remains.


Solution

  • There is good article on this : http://www.matrixprojects.net/p/uibarbuttonitem-ios11/

    Using this we can at least push rightbarbuttonitems to right till it leaves 8 pixel margin from trailing of the UINavigationBar.

    Explained really well.