我注意到的奇怪的事情:
let navController = UINavigationController(rootViewController: myRootViewController)
navController.view.layoutIfNeeded()
present(navController, animated: true, completion: nil)
在上面的代码中,当我添加 layoutIfNeeded() 时,我看到导航 Controller 栏按钮没有显示
我尝试添加这个的原因是我发现 Root View Controller 的 View 在模态呈现发生时自行布局。当我添加 layoutIfNeeded 时,它会在呈现之前执行 View 布局,这解决了我原来的问题。
最佳答案
尝试在您呈现的 View Controller 的 viewDidAppear:/viewWillAppear: 中使用 navController.view.layoutIfNeeded(),它应该会修复它。
关于ios - UINavigationController 按钮在模式呈现之前 layoutIfNeeded 时消失,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40619900/