Reputation: 16460
I've noticed by viewDidLoad method is never called when I present a view controller modally.
I.E:
InfoViewController *v = [[Global get] infoVC];
[self presentModalViewController: v animated: true];
Is there anyway I can get it to call this? I've put my viewDidLoad code in ViewDidAppear, I'm worried those items will be drawn twice in the view? If it's opened twice? Or does it get removed from memory?
Upvotes: 0
Views: 187
Reputation: 5042
viewDidLoad will only get called when the controller is created. So if your: [[Global get] infoVC] is not allocating and returning the controller (returning an already created controller) viewDidLoad will not be called. In viewDidAppear it is safe to adjust the views related to your controller. If you created them in viewDidLoad they will already exist.
Or if you want viewDidLoad called create a new controller.
infoViewController *v = [[InfoViewController alloc] initWithNibName:nil bundle:nil];
[self presentModalViewController: v animated: true];
[v release];
Upvotes: 2
Reputation: 17659
If you are just adding items to your view in viewDidLoad
, you could put that code in loadView
instead.
Upvotes: 1