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.
Taken from this answer: BarButtons now use Autolayout and thus require constraints.
Objective C
I stumbled upon this: UINavigationItem-Margin. It works like a charm.
I noticed a similar problem.
I reported an Apple Radar for a similar problem we noticed, #32674764 if you want to refer to it, if you create a Radar.
I also created a thread in Apple's forum, but no feedback yet: https://forums.developer.apple.com/message/234654
Swift version of thedeveloper3214's custom UINavigationBar subclass' layoutSubviews method(https://stackoverflow.com/a/46660888/4189037):