uinavigationbarios11xcode9swift3.2

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.


Solution

  • After some effort i came to know that i am setting the view's leading space before setting as NavBarTitleView

    navView.viewLeadingConstraint.constant = (UIDevice().isIPhone5 || UIDevice().isIPhone4) ? -15:-40
    

    due to above code my back button hides so i removed above line of code and add following method in NavView which resolve my problem.

    override var intrinsicContentSize: CGSize {
        return UILayoutFittingExpandedSize
    }