0

I have a problem with my navigationbar. I go to the "audio" viewcontroller, if I go back, I can't click on my navigationbar button menu and "?".

I test on an iOS 10, iOS 11 and iOS 12 device on simulator, there is no problem. I know that there are changes with navigationbar with iOS13.

The code to add my navigationbar and the menu button:

let navBar = UINavigationBar()

// Default attributes
navBar.tintColor = MixedColors.clearWhiteColor()
navBar.isTranslucent = false
navBar.layer.elevate(elevation: 3)
navBar.titleTextAttributes = [NSAttributedString.Key.foregroundColor:MixedColors.clearWhiteColor()]
self.btnNetwork.alpha = 0
navBar.items = [UINavigationItem()]

// Ajout du boutton menu
let frame = CGRect(x: 0, y: 0, width: 25, height: 45)
self.btnMenu = UIView(frame: frame)
let imgView = UIImageView(frame: frame)
imgView.image = UIImage(named: "ic_menu")
imgView.contentMode = .scaleAspectFit
imgView.withColor(color: MixedColors.clearWhiteColor())
self.btnMenu.addSubview(imgView)
// Actions sur le menu
let tapGesture = UITapGestureRecognizer(target: self, action: #selector(self.open))
self.btnMenu.isUserInteractionEnabled = true
self.btnMenu.addGestureRecognizer(tapGesture)

var leftButtonItems: [UIBarButtonItem] = []
let btn = UIBarButtonItem(customView: self.btnMenu)
btn.accessibilityIdentifier = "MenuBtn"
leftButtonItems.append(btn)
leftButtonItems.append(UIBarButtonItem(title: (self.title_bar), style: UIBarButtonItem.Style.plain, target: nil, action: #selector(self.open)))

navBar.items?.first?.setLeftBarButtonItems(leftButtonItems, animated: false)

The code to add "?" button:

guard let navigationBar = SAppState.sInst.navigationBar else { return }
let helpButton = UIBarButtonItem(image: UIImage(named: "ic_help_outline_white"), style: .plain, target: self, action: #selector(self.presentHelper))
navigationBar.items?[0].rightBarButtonItems = [helpButton]

SAppState.sInst.navigationBar = navigationBar

enter image description here

enter image description here

2
  • This may help. Commented Nov 20, 2019 at 13:31
  • I'm using Xcode 11.2.1 ... Commented Nov 20, 2019 at 13:36

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.