viewcontroller1、viewcontroller2という名前の2つのビューがあります。すべてのviewcontrollerには約3枚の画像が読み込まれます(XIBに読み込む)。[self.navigationcontrollerpushviewcontroller]を使用してview1をview2にプッシュしようとすると、メモリが解放されません(viewcontrller1を解放できないかuiimageviewを解放できないことを確認したい)私のコードのエラー??
次のようなviewcontroller1コード:
viewcontroller1.h
@interface ViewController : UIViewController
@property(strong,nonatomic)IBOutlet UIImageView *mainImageView;
@property(strong,nonatomic)IBOutlet UIImageView *topwallImageView;
@property(strong,nonatomic)IBOutlet UIImageView *buttonImageView;
viewcontroller1.m
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)viewDidUnload
{
self.mainImageView = nil;
self.topwallImageView = nil;
self.buttonImageView = nil;
[super viewDidUnload];
// Release any retained subviews of the main view.
}
-(void)dealloc
{
[mainImageView release];
[topwallImageView release];
[buttonImageView release];
[super dealloc];
}
-(IBAction)main2ViewController:(id)sender
{
Main2ViewController *main2ViewController =[[Main2ViewController alloc]initWithNibName:@"Main2ViewController" bundle:nil];
[self.navigationController pushViewController:main2ViewController animated:NO];
[main2ViewController release];
}