Question

first of all... i'm italian, so i'm sorry for my bad english!

so... this is my app: i'm using a navigation controller: in the first view there are 10 buttons and every button calls a functions like this:

    [self pushViewController:nameview animated:YES];

to a different uiviewcontroller! So i have 11 uiviewcontroller! Every controller is decleared like here

@interface ...
IBoutlet UIViewController *viewcontroller;
...
@property (nonatomic, retain) IBOutlet UIViewController *viewcontroller;

Finally i have to say that i'm working with IB!

My problem is that my app doesn't release memory! when i'm in a view and i tap on the "backbuttonitem" (created by IB, not by me) the last view doesn't became released (again, sorry for my bad english)... and if an user see all 10 view, the app receive a warning massage (low-memory)!

How can i release the last view saw before the popviewcontroller action?

thanks :D

Was it helpful?

Solution

When you push a view controller onto a navigation controller you need to release it as the navigation controller now owns it. For example you would do the following:

UIViewController *controller = [[UIViewController] initWithNibName:@"Nib" bundle:nil];
[self pushViewController:controller animated:YES];
[controller release];

Then when you use popViewControllerAnimated: the navigation controller will take care of making sure the view controller is released from memory.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top