简体   繁体   English

在模态演示之前,如果layoutIfNeeded UINavigationController按钮消失

[英]UINavigationController buttons disappear when layoutIfNeeded before modal presentation

Odd thing I am noticing: 我注意到的奇怪的事情:

let navController = UINavigationController(rootViewController: myRootViewController)
navController.view.layoutIfNeeded()
present(navController, animated: true, completion: nil)

In above code I am seeing the navigation controller bar button not showing when I add the layoutIfNeeded() 在上面的代码中,当我添加layoutIfNeeded()时,我看到导航控制器栏按钮未显示

The reason I am trying to add this is I am finding the root view controller's view lays itself out while the modal presentation is happening. 我尝试添加此代码的原因是,我发现模态表示发生时,根视图控制器的视图已布局好。 When I add the layoutIfNeeded it does the view layout before presenting which fixes my original problem. 当我添加layoutIfNeeded时,它会在呈现之前进行视图布局,从而解决了我原来的问题。

尝试将navController.view.layoutIfNeeded()扔到要显示的视图控制器的viewDidAppear:/ viewWillAppear:中,它应该对其进行修复。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用自适应segue实现UINavigationController用于模态表示,而不是用于弹出窗口 - How to implement a UINavigationController for modal presentation, not for popover, with an adaptive segue 设置模式表示样式,导致视图消失(Xcode 6) - Setting Modal Presentation Style causing views to disappear (Xcode 6) 广告加载时按钮消失 - Buttons disappear when ad loads UINavigationController工具栏按钮在按下时不动画 - UINavigationController toolbar buttons not animating when pressed 最好在约束改变之前或之后调用 .layoutIfNeeded() - Is best to call .layoutIfNeeded() before or after constraints are changed 修复了滚动时消失的按钮/单元格 - Fixed Buttons/Cells that disappear when scrolling 切换标签栏项目时,UINavigationController如何将其整个视图控制器表示层次结构保存在内存中? - How can UINavigationController hold in memory its entire view controller presentation hierarchy when switching tab bar items? 当呈现为模态视图控制器时,ARC UINavigationController堆栈未被释放 - ARC UINavigationController stack not getting deallocated when presented as modal view controller 当不是模态时,展开segue不会忽略自适应弹出窗口 - Unwind segue doesn't dismiss adaptive popover presentation when not modal 当呈现UINavigationController模态时,segue.destinationViewController为nil - segue.destinationViewController is nil when presenting UINavigationController modal
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM