UINavigationBar back button not showing on iPhone X iOS 11

I have a problem. When I run my application on the iPhone SE simulator, it shows the back button in the navigation bar like this.

enter image description here

But when I launch the same application on iPhone X, iPhone 8 and iPhone 8 plus iOS 11 and Xcode 9, there is no back button on the navigation bar and it is not for a specific viewController for all ViewControllers. Here is an example

enter image description here

Can anyone explain why this is happening.

+4
source share
2 answers

After some effort, I found out that I am setting the front view space before setting as NavBarTitleView

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

- , NavView, .

override var intrinsicContentSize: CGSize {
    return UILayoutFittingExpandedSize
}
0

, . .

.

 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
    )

api , .

+1

Source: https://habr.com/ru/post/1686038/


All Articles