iPhone SDK - keep data in modal view
- by swalkner
Hi all,
I've got a modal view loaded the following way:
ModalViewController *modalController = [[ModalViewController alloc] initWithNibName:@"ModalViewController" bundle:nil];
searchController.delegate = self;
[self.navigationController presentModalViewController:modalController animated:YES];
[modalController release];
When the modal view appears, "viewDidLoad" is called. When I dismiss the modal view via
[self.navigationController dismissModalViewControllerAnimated:YES];
the method "viewDidUnload" ISN'T called, but the next time I let the modal view appear, "viewDidLoad" is called again.
My problem now is that I'm creating an NSArray in the modal view's "viewDidLoad" - and as I'm fetching the data from the web, I would like to do it only once. But this way, it's fetched every time...
Any hints how I could achieve that the data is only fetched once? I would really like to do it in the modal view and not in the parent and provide the array as parameter to the modal view...
Thanks!