Should EXPLICITly call willMoveToParentViewController: (UIViewController *) parent and didMoveToParentViewController: (UIViewController *) parent?

In a WWDC 2012 session, under the heading Evolution of view controllers in iOS - (void)willMoveToParentViewController:(UIViewController *)parent and - (void)didMoveToParentViewController:(UIViewController *)parent is mentioned for use in the custom implementation of the view transition container.

If I'm not mistaken, it seems that you need to call these methods EXPLICITLY , either before - (void)removeFromSuperview , or after - (void)addSubview:(UIView *)view

However, when I registered them with subclass implementations, it shows that they were called IMPLICITLY . They were called to the right places automatically.

So, I'm a little confused if these methods REALLY NEED to be called explicitly, as described in a WWDC session, or he shouldn't follow it and clear unnecessary lines of code.

+8
ios uiviewcontroller uiview transition wwdc
source share
1 answer

Explained in my book:

http://www.apeth.com/iOSBook/ch19.html#_container_view_controllers

Basically, one of the two is really implicitly called, and the other you must explicitly specify. This is madness; I have to look for rules every time.

+13
source share

All Articles