【问题标题】:navigationBar backButton title present but arrow missing on instantiated viewControllernavigationBar backButton 标题存在,但实例化的 viewController 上缺少箭头
【发布时间】:2017-04-12 12:57:25
【问题描述】:

我正在使用以下代码从一个 viewController 推送到同一 viewController 的另一个实例。 viewController 是故事板中导航堆栈的顶部视图:

let storyboard = UIStoryboard(name: "Main", bundle: nil)
if let vc2 = storyboard.instantiateViewController(withIdentifier: "MyViewController") as? MyViewController {
    self.navigationController?.pushViewController(vc2, animated: true)
}

当 vc2 被按下一段时间后,左后箭头和 backButton 的标题可见,但箭头很快消失,只剩下 backButton 的标题。

我假设这是因为实例化的 viewController 是故事板中的 topViewController。

我试过了:

self.navigationItem.hidesBackButton = false

但这不起作用。不确定在这种情况下如何使后向箭头(克拉)可见。 backButton 标题继续显示并正确按下返回上一个视图。

【问题讨论】:

  • 我检查并没有引用或替换后退按钮。正在自动显示正确的标题。只是箭头不可见。

标签: ios swift navigationcontroller navigationitem


【解决方案1】:

试试这个

self.navigationItem.leftBarButtonItem = nil

如果不起作用,请检查navigation的外观颜色

【讨论】:

  • 这就是答案。将 leftBarButtonItem 设置为 nil。非常感谢。
猜你喜欢
  • 2014-10-04
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-10-14
  • 1970-01-01
  • 2013-04-09
  • 2014-06-16
相关资源
最近更新 更多