0

UIViewController のプッシュ & ポップの問題に直面しています。私は 2 つの UIViewControllers にA&と言いBます。

私は好きなものからIBActionプッシュするものを書いていますBA

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、 setなどの他のすべての方法を試しましbView=nil;たが、うまくいきません!

任意のヘルプ、提案!

4

1 に答える 1

1

bView代わりに、アニメーション完了ブロック内でリリースしてみてください。

古いスタイルを使用でき+ setAnimationDidStopSelector: ます。iOS4より前のデバイスをサポートする必要がない場合は、アニメーションブロックを使用できます。animateWithDuration:delay:options:animations:completion:

于 2012-06-29T06:15:00.217 に答える