Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/xpath/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone UIViewController推送中的问题&;流行音乐_Iphone_Ios_Release_Dealloc_Pushviewcontroller - Fatal编程技术网

Iphone UIViewController推送中的问题&;流行音乐

Iphone UIViewController推送中的问题&;流行音乐,iphone,ios,release,dealloc,pushviewcontroller,Iphone,Ios,Release,Dealloc,Pushviewcontroller,我遇到了推送和弹出UIViewController的问题。我有两个UIViewController说A和B 我写了一个iAction,其中我从A推到B,比如 B *bView=[[B alloc] initWithNibName:@"B" bundle:nil]; [UIView beginAnimations:@"animation" context:nil]; [UIView setAnimationDuration:0.7]; [self.navigationController push

我遇到了推送和弹出UIViewController的问题。我有两个UIViewController说
A
B

我写了一个
iAction
,其中我从
A
推到
B
,比如

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
中,我编写了一个
I操作
,弹出到
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];
我还从
B

-(void) dealloc
{
   [super dealloc];
}
如果我不释放
bView
它将不会调用dealloc,并且可能会造成内存问题。

这个问题是因为我正在应用动画吗?

我尝试了所有其他方法,比如
autorelease
,设置
bView=nil等等。但是这些对我来说不起作用


任何帮助,建议

尝试在动画完成块内释放
bView

您可以使用老式的
+setAnimationDidStopSelector:

或者,如果您不需要支持iOS4之前的设备,您可以使用动画块
animateWithDuration:delay:options:animations:completion:

[bView release]没有问题;B类代码中还有其他错误,您可以使用NSZombie来跟踪问题的确切位置。或者您可以为您的B类粘贴代码。NSZombie已启用,它显示消息,
消息发送到解除分配引用
它将显示一些内存地址,在控制台上您可以使用“po内存地址”,并查看哪个实例导致此问题。