我遇到了推送和弹出我的 UIViewController 的问题。我有两个 UIViewControllers 说A
& B
。
我写了一个我从喜欢IBAction
推动到的,B
A
B *bView=[[B alloc] initWithNibName:@"B" bundle:nil];
[UIView beginAnimations:@"animation" context:nil];
[UIView setAnimationDuration:0.7];
[self.navigationController pushViewController:bView animated:NO];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:self.navigationController.view cache:NO];
[UIView commitAnimations];
[bView release]; //Problem is here, If I comment this line, it works fine! else it crashes after my some transitions from A [push] B, B [pop] A.
现在B
我写了一个IBAction
弹出到A
下面的喜欢
[UIView beginAnimations:@"animation" context:nil];
[UIView setAnimationDuration:0.7];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:self.navigationController.view cache:NO];
[self.navigationController popViewControllerAnimated:NO];
[UIView commitAnimations];
我也打来[super dealloc]
电话B
-(void) dealloc
{
[super dealloc];
}
如果我不释放bView
它不会调用 dealloc,并且可能会产生内存问题。
这个问题是因为我应用了动画吗?
我尝试了所有其他方式,例如autorelease
,设置bView=nil;
等,但这些对我不起作用!
任何帮助,建议!