ios - 容器 View Controller 中的导航 Controller 问题

标签 ios iphone uiviewcontroller uinavigationcontroller uicontainerview

阶段 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/

相关文章:

ios - 无法使 : UICollectionElementKindCell with identifier 类型的 View 出列

ios - HStack 中的两个按钮相互执行操作

ios - tabBarController 选定的索引在 viewController 中不起作用 [Swift]

ios - 如何为 ipad 显示全屏 ipad

c# - 如何对 Controller 中的 View 进行编程更改出现在 Storyboard 中

iphone - TableView - 信号 SIGABRT

javascript - 页面加载后立即播放音乐(在 iPhone 中)(使用 HTML5/JS)

iphone - 每个 tableview 组中的自定义单元格数量

objective-c - 从 subview Controller 设置父 View Controller 类的属性值?

iphone - 在 UIViewController 中在哪里初始化一些东西