无法按下 NavigationBar 下方的 UIButton?

Unable to press UIButton underneath NavigationBar?

我有一个应用程序,其中有一个可以有导航子项的导航控制器。我必须在导航栏通常所在的位置放置一个 UI 按钮。

UI按钮连接到目标:

for button in arrayOfButtons {
    button.addTarget(self, action: #selector(buttonTouchUpInsideP3), for: [.touchUpInside])
    button.addTarget(self, action: #selector(buttonTouchInsideBoundsP3), for: [.touchDown, .touchDragEnter])
    button.addTarget(self, action: #selector(buttonDraggedOutOfBoundsP3), for: [.touchDragExit, .touchCancel]) //there is definitly combining that cud be done here...
}

基本上我不能简单地隐藏导航栏,因为我将它用于 sizing/autolayout,所以我尝试做的是:(这段代码在子导航控制器的 ViewDidLoad 中)

self.navigationController?.navigationBar.isUserInteractionEnabled = false

self.navigationController?.navigationBar.setBackgroundImage(UIImage(), for: .default)
self.navigationController?.navigationBar.shadowImage = UIImage()
self.navigationController?.navigationBar.isTranslucent = true

self.navigationItem.hidesBackButton = true

要删除它的 UI 并让它在那里不可见,这部分工作...但是,问题是我仍然无法按导航栏区域中的任何内容...即使我这样做 isUserInteractionEnabled = false.

我该如何解决这个问题!?这样我就可以点击下方的 UI 按钮(?)或者导航栏所在的位置??

还没有看到为我解决这个问题的 SO 问题:/

嗯,对于任何想知道的人:

@StonedStudio 是对的,我最终只是隐藏了导航栏,而是简单地创建了一个视图,其中导航栏的边界高度锚定在 view.safeAreaLayoutGuide.topAnchor 的顶部,这样它就形成了的将是导航栏,同时也允许点击! :)