几个API有点混沌,简单整理一下:
-
addChildViewController
: Adds the specified view controller as a child of the current view controller.
这个API跟view没有关系,是一个controller之间的关系。这个API也同时调用willMoveToParentViewController:self
。 -
willMoveToParentViewController
: Called just before the view controller is added or removed from a container view controller. 这个API必须在removeFromParentViewController
前调用,用作willMoveToParentViewController:nil
。 -
removeFromParentViewController
: Removes the view controller from its parent. 这个API同时调用了didMoveToParentViewController
。 -
didMoveToParentViewController
: Called after the view controller is added or removed from a container view controller。 -
transitionFromViewController:toViewController:options:completionHandler:
这个API只完成了view的设置,对controller的设置还需要调用前面几种API。