0

我有两个 uiviewcontroller,我正在释放 dealloc 中的所有资源,并在 didunload 中将它们设置为 nil,但是当我遇到两个 viewcontroller 时,内存仍在不断增加。

我正在跟踪这篇文章中使用的内存和释放内存

谁能建议为什么会这样?

这是第二个视图控制器:

- (void)viewDidUnload {
    adView.delegate = nil;    
    [self setCountDown:nil];    
    [self setUploadPhoto:nil];   
    [self setBackclicked:nil];   
    [self setInfo:nil];   
    [self setCloseButton:nil];   
    [self setHow2usebg:nil];   
    [self setHow2useInstruction:nil];  
    [self setHow2useicon:nil];    
    [self setVc1:nil];   
    [self setVc:nil];   
    adView = nil;   
    [super viewDidUnload];
}

-(void)dealloc
{

    [adView release];
    [closeButton release];
    [how2usebg release];
    [how2useInstruction release];
    [how2useicon release];
    [videoRecorder1 release];
    [uploadPhoto release];
    [countDown release];
    [backclicked release];
    [info release];
    [vc release];
    [talkingImage release];
    [backgroundImage release];
    [super dealloc];
}
4

1 回答 1

1

我想你是在另一个视图控制器上添加一个视图控制器..就像下面的行..

[self.view addSubView:yoursecondview];

创建一个 Appdelegate 对象,然后添加窗口,而不是 self.view

AppDelegate *object=[[UIApplication SharedApplication] delegate];
[self.view removeFromSuperview];
[object.window addSubView:yoursecondview];
于 2012-10-10T06:45:22.170 回答