I don’t get the delegate logic of UIViewController.
It has delegate method of
– viewWillAppear:
– viewDidAppear:
– viewWillDisappear:
– viewDidDisappear:
So, every time, if a view of a viewcontroller appear or disappear, the according above methods inside the viewcontroller will be called?
I have two viewcontrollers. viewcontroller2’s view (view2) is a sub view of viewcontroller1’s view (view1).
if I set view2’s alpha to 0, then this view2 will disappear. but – viewWillDisappear: and – viewDidDisappear: of viewcontroller2 are never called.
So what’s the point please?
How should I use these methods to control the appear and disappear of a view?
Thanks
Those delegates are delegates of the viewController, not the subViews added to the viewController’s view. You need to set the alpha of the individual subViews manually.
– viewWillAppear: – viewDidAppear: – viewWillDisappear: – viewDidDisappear:
…are called when your viewController is instantiated, or removed from the screen intentionally, or in response to a low memory condition.