0

我正在使用以下代码从 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 标题继续显示并正确按下它返回到上一个视图。

4

1 回答 1

1

试试这个

self.navigationItem.leftBarButtonItem = nil

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

于 2017-04-12T13:07:56.003 回答