这段代码工作正常
- (IBAction)gotoAboutGame:(id)sender
{
aboutGame *aboutGameObj = [[aboutGame alloc]init];
[UIView transitionFromView:self.view toView:aboutGameObj.view duration:2 options:UIViewAnimationOptionTransitionCurlUp completion:^(BOOL finished) {
[aboutGameObj release];
}];
[self release];
}
但是当我回到rootviewcontroller时,我正在接受僵尸攻击
- (IBAction)gotoMain:(id)sender
{
ViewController *viewControllerObj = [[ViewController alloc]init];
[UIView transitionFromView:self.view toView:viewControllerObj.view duration:2 options:UIViewAnimationOptionTransitionCurlUp completion:^(BOOL finished) {
[viewControllerObj release];
}];
[self release];
}
它显示了rootviewcontroller视图,但是当我触摸任何按钮僵尸攻击时。
答案 0 :(得分:1)
[viewControllerObj release];
将它放在动画块之后
答案 1 :(得分:0)
这段代码是什么类的?
这条线对我来说非常可疑
[self release];
为什么对象释放自己?当然,创建它的对象应该是这样做的。
答案 2 :(得分:0)
按照惯例,类名以大写字母开头,而不是小写
你的记忆管理是错误的; [self release]
几乎永远不正确(有非常深奥的案例)。 retain
应该平衡什么?