アプリのナビゲーションにNavigationControllerを使用しています。PushViewControllerが起動すると(someUIViewController、true)、デフォルトのアニメーションでビューが変更されます(子コントローラーの場合は右から左に移動します)。このアニメーションを変更するにはどうすればよいですか?今私はこれを使用しています:
this.NavigationController.PushViewController(someUIViewController,true);
UIView.BeginAnimations(null);
UIView.SetAnimationDuration(0.4);
UIView.SetAnimationTransition(UIViewAnimationTransition.FlipFromRight, NavigationController.View,true);
UIView.CommitAnimations();
しかし、私は4つのUIViewAnimationTransitionタイプに制限されています。必要なもの(下から上へのビューの外観)を見つけました。
this.NavigationController.PushViewController(someUIViewController,true);
var theAnimation = CABasicAnimation.FromKeyPath("transform.translation.y");
theAnimation.Duration = 0.3f;
theAnimation.From = NSNumber.FromFloat(this.View.Frame.Height);
theAnimation.To = NSNumber.FromFloat(0f);
NavigationController.View.Layer.AddAnimation(theAnimation, "animate");
NavigationController.View.Layer.AnimationForKey("animate");
しかし、CABasicAnimationが開始すると、デフォルトのアニメーション(左から右に親コントローラーに移動)も開始します。結果は間違った組み合わせになります。1つだけを実行する(yでの変換)か、カスタムアニメーションを作成するにはどうすればよいですか?