private void HandlePanGesture(UIPanGestureRecognizer recognizer) { var translation = recognizer.TranslationInView(recognizer.View); //distance of pan gestire from start position var distance = translation.X / UIScreen.MainScreen.Bounds.Width * -1; switch (recognizer.State) { case UIGestureRecognizerState.Began: _panGestureIsActive = true; MainViewController.DismissViewController(true, null); break; case UIGestureRecognizerState.Changed: var update = Math.Max(Math.Min((float)distance, 1.0f), 0.0f); UpdateInteractiveTransition(update); break; default: _panGestureIsActive = false; var velocity = recognizer.VelocityInView(recognizer.View).X * -1; if (velocity >= 100 || velocity >= -50 && distance >= 0.5) { FinishInteractiveTransition(); } else { CancelInteractiveTransition(); } break; } }
void CloseMenu() { MainViewController.DismissViewController(true, null); }