We are creating an application with a main menu from which you can navigate to a second view with a back button and about 6 other buttons which loads 6 different subviews into memory (array) depending which one you selected.
When the user selects the 'back' button I want to erase anything from memory that was allocated in the screen with the 6 buttons.
At the moment the application just builds up memory and nothing seems to get deallocated. Please see the screenshot in the URL below:
http://oi41.tinypic.com/jfi8ma.jpg
//Load all tab views into memory before loading them into an array
TimeViewController *timeView = [[TimeViewController alloc]init];
LocationViewController *locationView = [[LocationViewController alloc]init];
DropOffViewController *dropOffView = [[DropOffViewController alloc]init];
CompanyViewController *companyView = [[CompanyViewController alloc]init];
PaymentViewController *paymentView = [[PaymentViewController alloc]init];
//Set delegates of the tab views
timeView .delegate = self;
locationView.delegate = self;
//Load all tab views into array
[tabViews insertObject:timeView atIndex:0];
[tabViews insertObject:locationView atIndex:1];
[tabViews insertObject:dropOffView atIndex:2];
[tabViews insertObject:companyView atIndex:3];
[tabViews insertObject:paymentView atIndex:4];
for(int x = 0; x<5;x++)
{
UIViewController *tempView = [[UIViewController alloc]init];
tempView = [tabViews objectAtIndex:x];
[self addChildViewController:tempView];
}