Equivalent of Fragment (Android) in iOS

后端 未结 1 454
暖寄归人
暖寄归人 2021-01-31 03:33

I want to know if there is a way to use some view controllers within a view controller which provides the same functionality as Fragments in Android? I want to use

相关标签:
1条回答
  • 2021-01-31 04:12

    Container View Controllers allow to include child view controller inside another view controller. Take a look at the docs by clicking on the "more..." link in the class overview.

    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....

    Using them in storyboards is as simple as dragging the Container View to your view controller.

    enter image description here

    And Xcode will automatically add a child view controller to it

    enter image description here

    0 讨论(0)
提交回复
热议问题