Question

I have found a strange bug in ios. When I use UINavigationController and push other controllers, the titleView shifted to the right so much as how many controllers was pushed

It's looks like this:

enter image description here

My code is simple:

self.navigationItem.title = @"Test Title";

In the second case, controller has 5th in viewControllers stack. The controller in the all cases is same.

I was using the appearance for UIBarButtonItem, in my AppDelegate.

[[UIBarButtonItem appearance] setBackButtonTitlePositionAdjustment:UIOffsetMake(-1000, 0) forBarMetrics:UIBarMetricsDefault];
Was it helpful?

Solution

I was fix it with some trick =)

[[UIBarButtonItem appearanceWhenContainedIn:[UINavigationBar class], nil] setTitleTextAttributes:@{UITextAttributeFont: [UIFont systemFontOfSize:0.1]}
                                                                                        forState:UIControlStateNormal];
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top