iosmemory-warning

Received memory warning. Level=1 - UITabBarController application with 5 tabs


My Application consists of 5 tabs. Where 4 of them contains at around 20 textfields (created pro grammatically and added as subview to the view) in each, my last tab is a preview for the previous tabs (screenshots). When user goes to this tab he should be able to preview and has an option to trigger an email with the preview, (attaching all 4 tabs screenshots to the email) I have implemented this successfully but resulted with memory warnings. Any help would be appreciated to resolve my issue.

I tried it in this way: Released objects in didReceiveMemoryWarning if the view is not visible

- (void)didReceiveMemoryWarning
{
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
    if (!self.view.window) {
        [preparedForTextField release];
        [agentTextField release];
        [phoneTextField release];
        [dateTextField release];
        [textFieldsArray release];
    }
    // Release any cached data, images, etc. that aren't in use.
}

and reloaded the view again in viewDidLoad. Still I am getting memory warnings.


Solution

  • If you need all the stuff that you have in memory to be there, just ignore the memory warning (especially the level 1 warning comes quite easily). If you don't need all of it there and can later reload or recreate what you don't need now, remove it from memory until needed (and then reload or recreate it).