Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UINavigationBar back button not showing on iPhone X iOS 11

I am facing an issue, When i run my app on iPhone SE simulator it shows back button on nav bar like this.

enter image description here

But when i run the same app on iPhone X, iPhone 8 and iPhone 8 plus iOS 11 and XCode 9 there is no back button on nav bar and its for all ViewControllers not for specific viewController. Here is the example

enter image description here

Can anyone tell why is this happening.

like image 833
Waris Shams Avatar asked Nov 08 '22 16:11

Waris Shams


1 Answers

I had the issue where the back button was only a little bit. In the debugging console it was showing a few broken constraints in the navigation bar.

I found this line in the app delegate to be the issue.

 UIBarButtonItem.appearance().setBackButtonTitlePositionAdjustment( // Remove the text "Back" from the back button so only the back arrow is visible
        UIOffset(horizontal: -100, vertical:-100),
        for: UIBarMetrics.default
    )

try and find any appearance api calls in your code and see if you might be modifying the bar button offsets.

like image 50
Daniel Hakimi Avatar answered Dec 04 '22 01:12

Daniel Hakimi