看看我下面的代码,点击“返回”按钮后出现内存错误,如果我删除[aboutView release]问题就解决了,这是为什么?以及我应该如何发布 aboutView?
-(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];
}
第二个视图控制器:
-(IBAction)back {
[UIView beginAnimations:@"" context:nil];
[UIView setAnimationDuration:1.0];
[self.view setAlpha:0];
[UIView commitAnimations];
[self.view removeFromSuperview];
}