0

をアニメーション化した後、いくつかの点をそれをスライドさせ、提示のViewControllerに戻っていないdismissViewControllerAnimated。 私のMainViewControllerからこのコードを使用してモーダルを起動し、それを閉じます。は、私が</strong>で<strong>スライド画面でのViewControllerにしたいのViewController

なぜ解散スライドアニメーションが機能しないのですか?このいずれかの

[presenterVC dismissViewControllerAnimated:NO completion:nil]; 

// Present a React Component sliding from the right on top of current ViewController 
+ (void)presentSlidingFromRight:(UIViewController*)presented onViewController:(UIViewController*)presenterVC { 
    CATransition *transition = [[CATransition alloc] init]; 
    transition.duration = 1; 
    transition.type = kCATransitionPush; 
    transition.subtype = kCATransitionFromRight; 
    [presenterVC.view.window.layer addAnimation:transition forKey:kCATransition]; 
    [presenterVC presentViewController:presented animated:NO completion:nil]; 
} 

// Dismiss a React Component sliding to the right 
+ (void)dismissSlidingToRight:(UIViewController*)presented onViewController:(UIViewController*)presenterVC { 
    CATransition *transition = [[CATransition alloc] init]; 
    transition.duration = 3; 
    transition.type = kCATransitionPush; 
    transition.subtype = kCATransitionFromLeft; 
    [presenterVC.view.window.layer addAnimation:transition forKey:kCATransition]; 
    [presenterVC dismissViewControllerAnimated:NO completion:nil]; 
} 

答えて

1

あなたは、この行を変更しようとすることができ

[presenterVC dismissViewControllerAnimated:YES completion:nil]; 

更新

Main Thread

+0

私がYESに設定すると、モーダルはアニメートされますが、デフォルトのアニメーション(下にすばやくスクロールする)が適用されます。なぜ私の移行を無視しているのですか? – Herno

+0

@Hernoの解除機能では、遷移タイプを変更して、プッシュの代わりにフェードを使用してみることができますか? 'transition.type = kCATransitionFade;' – zero

+0

ありがとうございました。したがって、MainView Controllerでコードを実行するとうまく動作します。しかし、私はこの静的なクラスを持っているので、なぜそれがアニメーション化しないのかわかりません。私は、後で使用するために、表現されたコントローラと提示するコントローラを保持しています。これは同じコードですが、MainViewControllerでない別のクラスで使用するとうまくいきません。それはどうしたの? – Herno