阶段 1:
我在导航 Controller 中嵌入了一个 Controller 。我正在尝试在此 Controller 内创建自定义容器 View 。
第 2 阶段:
我创建了 UIView 的 xib,其中包含 scrollView,我将其传递给 Controller 初始化程序并将该 Controller 传递给自定义容器。
ScrollView 插图自动更改为 y:-64。
我尝试过的总结:
从这里What does addChildViewController actually do? 我知道父 Controller 将导航传递给子 Controller 。那就是创建这种插图调整。
然后我尝试禁用该属性
automaticallyAdjustsScrollViewInsets
Controller 设置为 false 但仍然无法正常工作
来自 iOS 7: Custom container view controller and content inset我发现 automaticallyAdjustsScrollViewInsets 属性也不适用于这种复杂的设置。
主要问题
当我将通过包含相同设置的 Storyboard创建的 Controller 添加到容器时,查看其工作正常。但是当我通过代码创建时,会出现 ScrollView 内容插入问题。 UIViewController Storyboard中的代码缺少什么属性?
最佳答案
我也遇到过这个问题。 我没有太多时间深入研究这个问题。这让我感到很困惑。
但是: 我解决了禁用调整滚动导航 Controller 、父 Controller 和容器 View (子) Controller 的问题, 我在不透明条下禁用了问题已经解决。
关于ios - 容器 View Controller 中的导航 Controller 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42108785/