幾個(gè)API有點(diǎn)混沌姻锁,簡(jiǎn)單整理一下:
-
addChildViewController
: Adds the specified view controller as a child of the current view controller.
這個(gè)API跟view沒(méi)有關(guān)系奴烙,是一個(gè)controller之間的關(guān)系颤诀。這個(gè)API也同時(shí)調(diào)用willMoveToParentViewController:self
。 -
willMoveToParentViewController
: Called just before the view controller is added or removed from a container view controller. 這個(gè)API必須在removeFromParentViewController
前調(diào)用验夯,用作willMoveToParentViewController:nil
芦圾。 -
removeFromParentViewController
: Removes the view controller from its parent. 這個(gè)API同時(shí)調(diào)用了didMoveToParentViewController
昔案。 -
didMoveToParentViewController
: Called after the view controller is added or removed from a container view controller乒验。 -
transitionFromViewController:toViewController:options:completionHandler:
這個(gè)API只完成了view的設(shè)置愚隧,對(duì)controller的設(shè)置還需要調(diào)用前面幾種API。