Hello all,
I have multiple views in my application with respective view controllers. What I am doing is as follows.
Here is the more illustrative code:
- (void)applicationDidFinishLaunching:(UIApplication *)application
{
View1Controller *viewController1 = [[View1Controller alloc] initWithnibName:@"View1"];
View2Controller *viewController2 = [[View2Controller alloc] initWithnibName:@"View2"];
View3Controller *viewController3 = [[View3Controller alloc] initWithnibName:@"View3"];
[window addSubview:viewController1.view];
[window makeKeyAndVisible];
}
In View1Controller file:
For Some Button Action
- (IBAction) goTOView2:(id)sender
{
iPhoneApplicationAppDelegate *appDelegate = (iPhoneApplicationAppDelegate*) [[UIApplication sharedApplication] delegate];
[appDelegate.window.superView removeFromSuperview];
[appDelgate.window addSubview: appDelgate.viewController2.view];
}
Similarly for view3
I am retaining all this three view controller in my application delegate. When I want to switch to other view I have the following code.
Don't go on the syntax errors of the code.
This three view controller has multiple view with their own navigation controller which for pushing and popping different views.
My problem is when I run this application using instrument, I see as I switch from one view to another the memory consumption keeps increasing.
Please help and thanks for that in advance.