iOS 中的等效片段 (Android)

Equivalent of Fragment (Android) in iOS

我想知道是否有一种方法可以在视图控制器中使用某些视图控制器,它提供与 Android 中的 Fragments 相同的功能? 我想使用自定义视图控制器,所以我不想使用 NSTabViewControllerUISplitViewController

Container View Controllers 允许在另一个视图控制器中包含子视图控制器。单击 class 概览中的 "more..." link 查看 docs

Implementing a Container View Controller
A custom UIViewController subclass can also act as a container view controller. A container view controller manages the presentation of content of other view controllers it owns, also known as its child view controllers. A child's view can be presented as-is or in conjunction with views owned by the container view controller....

在故事板中使用它们就像将容器视图拖到视图控制器一样简单。

并且Xcode会自动给它添加一个子视图控制器