当我在AppInfoViewController中按下Button时,此代码在模拟器中打印“ viewwillappear in”,“ dealloc”。
但是在Iphone设备测试中,仅打印“ viewwillappear”
为什么?
并在此代码中产生内存泄漏?帮我!!

//一个控制器

-(void)viewwillappear
{
  NSLog(@"viewwillappear in");
 self.appInfoViewController=nil;

}
-(void)viewdidLoad
{
 self.appInfoViewController= [[[AppInfoViewController   alloc]initWithdetailInfomationArray:  detailInfomationArray]autorelease];

 self.appInfoViewController.modalTransitionStyle=UIModalTransitionStyleCrossDissolve;
 [self presentModalViewController:appInfoViewController animated:YES ];
}


// AppInfoViewController

-(void)ButtonPressed:(id)sender
{
[self dismissModalViewControllerAnimated:YES];
}

 -(void)dealloc
 {
  NSLog(@"dealloc in");
 }

最佳答案

您可以找到答案here

10-07 17:26