What exactly willMoveToParentViewController: and didMoveToParentViewController: do?

前端 未结 2 717
傲寒
傲寒 2020-12-24 14:03

I know that starting with iOS5 and the new UIViewController containment methods, you are supposed to call these methods together with addChildViewController:

2条回答
  •  生来不讨喜
    2020-12-24 14:24

    In addition to what has been said, they do call some delegate methods:

    addChildViewController calls [child willMoveToParentViewController:self]

    and removeFromParentViewController: calls [child didMoveToParentViewController:nil]

    Also, they modify the childViewControllers property, which holds an array of child view controllers.

提交回复
热议问题