看看我下面的代码,我点击“后退”按钮后出现内存错误,如果我删除,问题将被修复[aboutView release] 为什么?以及我应该如何发布关于视图?UIViewController动画内存版本
-(IBAction)swichView {
AboutView *aboutView = [[AboutView alloc] init];
[aboutView.view setAlpha:0];
[self.view addSubview:aboutView.view];
[UIView beginAnimations:@"" context:nil];
[UIView setAnimationDuration:1.0];
[aboutView.view setAlpha:1];
[UIView commitAnimations];
[aboutView release];
}
第二个视图Contorller:
-(IBAction)back {
[UIView beginAnimations:@"" context:nil];
[UIView setAnimationDuration:1.0];
[self.view setAlpha:0];
[UIView commitAnimations];
[self.view removeFromSuperview];
}
是否有一个原因,你添加'aboutView.view'而不是'aboutView'本身?崩溃的原因是'aboutView'不被保留。 – 2012-04-11 05:20:15