First let me state I am a noob at this.
I am making a view based application and everything is going well. One thing I am noticing though is that when the app loads on the phone, each new view I open takes up more memory. The problem is that when i navigate away from that view, no memory is released. I'm not sure if this is normal or not. I used the inspector tool and it did not show any memory leaks but I'm still confused. I will attach my ViewController.H and .M files and if anyone could tell me if there is proper memory management or not that would be great. If there is not proper memory management then could you point me in the right direction. I read some of apples documentation on this and got confused.
Here is the .H file:
I am making a view based application and everything is going well. One thing I am noticing though is that when the app loads on the phone, each new view I open takes up more memory. The problem is that when i navigate away from that view, no memory is released. I'm not sure if this is normal or not. I used the inspector tool and it did not show any memory leaks but I'm still confused. I will attach my ViewController.H and .M files and if anyone could tell me if there is proper memory management or not that would be great. If there is not proper memory management then could you point me in the right direction. I read some of apples documentation on this and got confused.
Code:
//
// MyappViewController.m
// Myapp
//
// Created by Bij on 7/2/11.
// Copyright 2011 __MyCompanyName__. All rights reserved.
//
#import "MyappViewController.h"
#import "view1.h"
#import "view2.h"
#import "view3.h"
#import "view5.h"
#import "view6.h"
#import "view7.h"
#import "view8.h"
#import "view9.h"
@implementation MyappViewController
- (IBAction)view1:(id)sender
{
view1 *second =[[view1 alloc] initWithNibName:nil bundle:nil];
[self presentModalViewController:second animated:YES];
}
- (IBAction)view2:(id)sender
{
view2 *second =[[view2 alloc] initWithNibName:nil bundle:nil];
[self presentModalViewController:second animated:YES];
}
- (IBAction)view3:(id)sender
{
view3 *second =[[view3 alloc] initWithNibName:nil bundle:nil];
[self presentModalViewController:second animated:YES];
}
- (IBAction)view5:(id)sender
{
view5 *second =[[view5 alloc] initWithNibName:nil bundle:nil];
[self presentModalViewController:second animated:YES];
}
- (IBAction)view6:(id)sender
{
view6 *second =[[view6 alloc] initWithNibName:nil bundle:nil];
[self presentModalViewController:second animated:YES];
}
- (IBAction)view7:(id)sender
{
view7 *second =[[view7 alloc] initWithNibName:nil bundle:nil];
[self presentModalViewController:second animated:YES];
}
- (IBAction)view8:(id)sender
{
view8 *second =[[view8 alloc] initWithNibName:nil bundle:nil];
[self presentModalViewController:second animated:YES];
}
- (IBAction)view9:(id)sender
{
view9 *second =[[view9 alloc] initWithNibName:nil bundle:nil];
[self presentModalViewController:second animated:YES];
}
- (void)dealloc
{
[super dealloc];
}
- (void)didReceiveMemoryWarning
{
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];
// Release any cached data, images, etc that aren't in use.
}
#pragma mark - View lifecycle
/*
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad
{
[super viewDidLoad];
}
*/
- (void)viewDidUnload
{
[super viewDidUnload];
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
@end
Code:
//
// MyappViewController.h
// Myapp
//
// Created by Bij on 7/2/11.
// Copyright 2011 __MyCompanyName__. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface MyappViewController : UIViewController {
IBOutlet UIViewController *view1;
IBOutlet UIViewController *view2;
IBOutlet UIViewController *view3;
IBOutlet UIViewController *view4;
IBOutlet UIViewController *view5;
IBOutlet UIViewController *view6;
IBOutlet UIViewController *view7;
IBOutlet UIViewController *view8;
IBOutlet UIViewController *view9;
}
- (IBAction)view1:(id)sender;
- (IBAction)view2:(id)sender;
- (IBAction)view3:(id)sender;
- (IBAction)view5:(id)sender;
- (IBAction)view6:(id)sender;
- (IBAction)view7:(id)sender;
- (IBAction)view8:(id)sender;
- (IBAction)view9:(id)sender;
@end