2011-11-06 7 views
5

私は[[self navigationController] popViewControllerAnimated:YES]に電話をかけようとしていますが、アニメーションを左から右にずらして右から左にスライドさせようとしています。これを行う簡単な方法は?私は前のビューに戻りたいと思います。どんな助けもありがとうございます。ありがとう!UINavigationController:逆方向のコントローラをポップします

答えて

8

私はしばらく前に使用したコードを見て、それを自分のために働かせることができます。あなたが望むあなたのケースではそう

typedef enum { 
    UIViewAnimationTransitionNone, 
    UIViewAnimationTransitionFlipFromLeft, 
    UIViewAnimationTransitionFlipFromRight, 
    UIViewAnimationTransitionCurlUp, 
    UIViewAnimationTransitionCurlDown, 
} UIViewAnimationTransition; 

:ゆうのみを使用するデフォルトのアニメーションのいくつかの異なる種類がありますsetAnimationTransition

[UIView beginAnimations:nil context:NULL]; 
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut]; 
[UIView setAnimationDuration:0.75]; 
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:self.navigationController.view cache:NO]; 
[UIView commitAnimations]; 

[UIView beginAnimations:nil context:NULL]; 
[UIView setAnimationDelay:0.375]; 
[self.navigationController popViewControllerAnimated:NO]; 
[UIView commitAnimations]; 

を変更する必要があり、りんごのサイトでは、アニメーションのこの種が可能であり、言います次のように使用します。

[UIView beginAnimations:nil context:nil]; 
    [UIView setAnimationCurve: UIViewAnimationCurveEaseInOut]; 
    [UIView setAnimationDuration:0.75]; 
    [self.navigationController popViewControllerAnimated:NO]; 
    [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:self.navigationController.view cache:NO]; 
    [UIView commitAnimations]; 
+0

ありがとう。 'pushViewController'を呼び出すようにスライドする方法はありますか? – Mason

+0

はい、私は言ったように、ここで行を変更する必要があります:[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:self.navigationController.view cache:NO]; – Wesley

+0

私はそれを理解しています。私は正しい移行を見つけることができません。 – Mason

16

これは、逆方向にビューコントローラをポップする方法です。その私のために働く100%

+0

これは私が探していたものです!ありがとう。 – iChirag

+2

タイプを2回設定しましたか? 'transition.type = kCATransitionPush'で十分でしょう。 –

関連する問題