UINavigationController的setViewControllers在IOS10中添加了返回按钮

6

注意到一个奇怪的问题:当使用setViewControllers:animated:替换UINavigationController中的视图控制器堆栈时,在动画期间会显示返回按钮,当动画完成时消失。仅在iOS10中发现(设备和模拟器均有),iOS8和9工作正常(没有返回按钮)。有人遇到过这个问题吗?


我有同样的问题。但是只有在参数animated设置为true时,返回按钮才会显示。 - Roman
有什么解决方案或变通方法吗?我唯一看到的是添加一个空的左侧按钮,但看起来有点不太好。 - Varrry
遇到了相同的问题,最终设置为 animated: false - frangulyan
1个回答

0

我也遇到了同样的问题,即使设置animated:false也是如此。 我还意识到当我不断重复时内存会增加。它们会留在后台吗?

我的代码:

firstNavigationViewController.setViewControllers([firstRootViewController, secondViewController], animated: false)//
UIApplication.shared.windows.filter {$0.isKeyWindow}.first?.rootViewController = firstNavigationViewController

我的解决方法是在viewWillAppear中设置以下内容:

navigationController?.navigationBar.backItem?.title = "Protokoll"

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接