第二个带有 UISearchController 的推送视图控制器在 UINavigationBar 中没有接收到触摸

Second pushed View Controller with UISearchController doesn't receive touches in UINavigationBar

我修改了 Apple 的 UICatalog 示例代码中的 AAPLSearchBarEmbeddedInNavigationBarViewController,以便在选择单元格时将 AAPLSearchBarEmbeddedInNavigationBarViewController 的另一个实例推入导航堆栈。在第二个视图控制器中,UISearchBar 设置为 UINavigationBar 的标题视图(就像第一个一样)不可点击(与第一个不同)。这似乎是一个错误。我如何解决它?这是我修改后的 UICatalog 代码: https://github.com/stevemoser/UICatalog

我还用 Xcode 6 和 7 进行了测试。两者都坏了。

解决方案是设置第一个 VC self.definesPresentationContext = NO 当导航离开它并确保在视图中调用 self.definesPresentationContext=YES 确实出现,以便可见 VC 允许定义表示上下文。

感谢 Rory McKinnel 让我走上正轨。