gpt4 book ai didi

ios - 在 iOS 中,使用 Storyboard,如何在容器 View 中设置 View Controller ?

转载 作者:技术小花猫 更新时间:2023-10-29 10:51:45 29 4
gpt4 key购买 nike

我在主 Storyboard中创建并绘制了一个名为 AutocompleteVC 的自定义 UIViewController。 AutocompleteVC 将用于几个不同的地方/ Storyboard 和不同的维度。

例如,在我的 Transit Storyboard中,如下所示,有一个名为 TransitVC 的自定义 UIViewController,如左侧所示。在 TransitVC 中,我有一个带有 IBOutlet 的容器 View ,称为 autocompleteContainerView。 autocompleteContainerView 有一个名为 autocompleteEmbedSegue 的 segue 到通用 UIViewController,在右侧以红色显示。

目标是让 TransitVC 在 autocompleteContainerView 中持有 AutocompleteVC。但我无法让它发挥作用。我想在容器 View 中执行此操作的原因是我可以使用自动布局对其设置约束。否则,我知道如何纯粹用代码来做到这一点。

我认为我的方法可能存在缺陷。如果我想最大限度地利用 Storyboard ,正确的做法是什么。

enter image description here

最佳答案

我不确定你在问什么。与容器 View 建立父/子关系非常简单,正如您所概述的那样。只需在父 View Controller 中创建一个容器 View ,创建 subview Controller 场景,然后按住 Control 键从容器 View 拖动到 subview Controller 以创建嵌入转场。

关于ios - 在 iOS 中,使用 Storyboard,如何在容器 View 中设置 View Controller ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19826725/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com