iPhone SDK - keep data in modal view

Posted by swalkner on Stack Overflow See other posts from Stack Overflow or by swalkner
Published on 2010-04-12T19:20:52Z Indexed on 2010/04/12 19:23 UTC
Read the original article Hit count: 248

Filed under:
|

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!

© Stack Overflow or respective owner

Related posts about iphone-sdk-3.0

Related posts about modalviews