我应该为 varSecondViewController 使用 release 还是 autorelease?
-(IBAction)takeNextStep: (id) sender
{
SecondViewController *varSecondViewController = [[SecondViewController alloc]
initWithNibName:@"SecondViewController" bundle:nil];
[self.navigationController pushViewController:varSecondViewController animated:YES];
[varSecondViewController release];
}
最佳答案
我的经验法则:
如果你打算使用它,然后不再需要引用它,释放它,
如果您要将它传递回调用者(即返回它),自动释放它。
关于iphone - 释放还是自动释放?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4158589/