I currently have an app with 2 view controllers inside a navigation controller. They are pushed in this order: A, B
A has an empty (but displayed) navigation bar and B has a navigation bar with:
1) A title view 2) A custom leftBarButtonItem.
This is the initialisation code:
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:self.addFavoriteButton]; // addFavorite is an IBOutlet to a view outside the view hierarchy of my VC.
When I go back from B to A, either by panning from the left or touching the back button, the right button is displayed in a weird position on the left of the screen during the transition.
The B layout is similarly used for a C view controller, without any issue.
You can see a screenshot from the botched transition: As you can see, the heart (my right button) is wrongly displayed.
How can I fix this ?
Figured it out:
My button had a constraint, removing it fixed the issue.