Reputation: 507
I have two UIViewControllers
, vc1 and vc2.
I want to switch between them. But before loading the view of the new view controller, I want to destroy/release/remove (I'm not sure abt the correct word to use here) the previous viewcontroller.
For example, when I am switching to vc2 from vc1 ,I want to destroy vc1 completely, so that when I return to vc1 from vc2, vc1 will be loaded from scratch (i.e. viewDidLoad
will be executed).
Which type of view switching should I opt for?
I am not using a navigation controller.
Currently I am using the presentModal... method, but when I use dismissModalViewcontroller
on the newly presented view controller, it doesn't show up a new instance of the previous view controller. Instead, it shows the already running instance of it.
I want the viewDidLoad
method of the previous view controller to run when I dismiss the newly presented view controller.
Upvotes: 0
Views: 2468
Reputation: 7386
What exactly needs to happen in viewDidLoad
?
You also have viewWillAppear
available to you, so it could be that you could move the required functionality there and still use the modal presentation.
Upvotes: 1