transitionFromViewController:toViewController:duration:options:animations:completion:
Transitions between two of the view controller’s child view
controllers.
– (void)transitionFromViewController:(UIViewController *)fromViewController toViewController:(UIViewController *)toViewController duration:(NSTimeInterval)duration options:(UIViewAnimationOptions)options animations:(void
(^)(void))animations completion:(void (^)(BOOL finished))completion
Parameters…
Discussion
This method adds the second view controller’s view to the view
hierarchy and then performs the animations defined in your animations
block. After the animation completes, it removes the first view
controller’s view from the view hierarchy.This method is only intended to be called by an implementation of a
custom container view controller. If you override this method, you
must call super in your implementation.
Am I correct that it simply means that [fromViewController.view.superview addsubview:toViewController.view] is called somewhere at the beginning of animation?
Also, does both fromViewController and toViewController need to be the child of self?
I just want confirmation and some explanation.
You are correct in this. What the text says, if you want, is that one view replaces the other. So, the latter takes the place of the other in the view hierarchy (as child of the superview) and your interpretation is the only possible one.
No. There need be no relationship between the two controllers.