Question

In the first view controller A I call the "presentModalViewController" and then the B view controller is added to the screen now.

The question is, is it true that the "A" view controller is still in the memory? Which means, will the viewDidLoad method be called after I had pop the "B" view controller out of the screen?

And what about calling the pushModalViewController method? Will the first view controller stay in the memory?

Was it helpful?

Solution

First of all you cannot push or present a view, it must be a UIViewController. Secondly answer to your question it is true, when pushing or presenting "B" ViewController, "A" still remains in memory. viewDidLoad of "A" does not called when "B" ViewController is Popped off the stack. If you want a function in A ViewController, that should always called then you can use

-(void)viewWillAppear:(BOOL)animated
-(void)viewDidAppear:(BOOL)animated

These will be called even after "B" ViewController is Popped off.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top