I want to get two buttons under status bar:
First, I hided navigationBar:
navigationController?.setNavigationBarHidden(true, animated: false)
and made 2 buttons on the place of NavigationBar. It worked on simulator, but on real device (iPhone 6) touch event didn't work when the buttons were in navigationBar area
I decided to make custom NavigationBar with transparent background and 2 buttons (one instead back btn and second as a rightView)
I tried instructions from Apple doc:
let backButtonBackgroundImage = UIImage(named: "testDpng.png")
let barAppearance =
UINavigationBar.appearance(whenContainedInInstancesOf: [SubViewController.self])
barAppearance.backIndicatorImage = backButtonBackgroundImage
barAppearance.backIndicatorTransitionMaskImage = backButtonBackgroundImage
// Nudge the back UIBarButtonItem image down a bit.
let barButtonAppearance =
UIBarButtonItem.appearance(whenContainedInInstancesOf: [SubViewController.self])
barButtonAppearance.setBackButtonTitlePositionAdjustment(UIOffset(horizontal: 0, vertical: -5), for: .default)
But nothing happened. The backBtn looks as usual.
How can I fix it? Is it correct way - replace navigation items? Or I should hide navigation bar as I tried from the beginning?