public SwipeTransitionInteractionController(UIScreenEdgePanGestureRecognizer gestureRecognizer, UIRectEdge edge)
        {
            GestureRecognizer = gestureRecognizer;
            Edge = edge;

            GestureRecognizer.AddTarget(() => GestureRecognizeDidUpdate(GestureRecognizer));
        }
Ejemplo n.º 2
0
        /**
         * Adds screen edge gestures to a view to present a menu.
         *
         * - Parameter toView: The view to add gestures to.
         * - Parameter forMenu: The menu (left or right) you want to add a gesture for. If unspecified, gestures will be added for both sides.
         *
         * - Returns: The array of screen edge gestures added to `toView`.
         */
        public List <UIScreenEdgePanGestureRecognizer> AddScreenEdgePanGesturesToPresent(UIView toView, UIRectEdge?forMenu = null)
        {
            var gestures = new List <UIScreenEdgePanGestureRecognizer>();

            if (forMenu != UIRectEdge.Right)
            {
                var leftScreenEdgeGestureRecognizer = new UIScreenEdgePanGestureRecognizer();
                leftScreenEdgeGestureRecognizer.AddTarget(/*SideMenuTransition.Current, */ (_) => SideMenuTransition.HandlePresentMenuLeftScreenEdge(leftScreenEdgeGestureRecognizer));
                leftScreenEdgeGestureRecognizer.Edges = UIRectEdge.Left;
                leftScreenEdgeGestureRecognizer.CancelsTouchesInView = true;
                toView.AddGestureRecognizer(leftScreenEdgeGestureRecognizer);
                gestures.Add(leftScreenEdgeGestureRecognizer);
            }

            if (forMenu != UIRectEdge.Left)
            {
                var rightScreenEdgeGestureRecognizer = new UIScreenEdgePanGestureRecognizer();
                rightScreenEdgeGestureRecognizer.AddTarget(/*SideMenuTransition.Current, */ (_) => SideMenuTransition.HandlePresentMenuRightScreenEdge(rightScreenEdgeGestureRecognizer));
                rightScreenEdgeGestureRecognizer.Edges = UIRectEdge.Right;
                rightScreenEdgeGestureRecognizer.CancelsTouchesInView = true;
                toView.AddGestureRecognizer(rightScreenEdgeGestureRecognizer);
                gestures.Add(rightScreenEdgeGestureRecognizer);
            }

            return(gestures);
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            var interactiveTransitionRecognizer = new UIScreenEdgePanGestureRecognizer();

            interactiveTransitionRecognizer.AddTarget(() => InteractiveTransitionRecognizerAction(interactiveTransitionRecognizer));
            interactiveTransitionRecognizer.Edges = UIRectEdge.Left;
            View.AddGestureRecognizer(interactiveTransitionRecognizer);
        }
Ejemplo n.º 4
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            // Attach the Edge Gesture.
            var edgeSwipeOpenRecognizer = new UIScreenEdgePanGestureRecognizer();

            edgeSwipeOpenRecognizer.AddTarget(() => InteractiveTransitionRecognizerAction(edgeSwipeOpenRecognizer, true));
            edgeSwipeOpenRecognizer.Edges = UIRectEdge.Left;
            View.AddGestureRecognizer(edgeSwipeOpenRecognizer);

            var edgeSwipeCloseRecognizer = new UIScreenEdgePanGestureRecognizer();

            edgeSwipeCloseRecognizer.AddTarget(() => InteractiveTransitionRecognizerAction(edgeSwipeCloseRecognizer, false));
            edgeSwipeCloseRecognizer.Edges = UIRectEdge.Right;
            View.AddGestureRecognizer(edgeSwipeCloseRecognizer);
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            var screenEdgePanGestureRecognizer = new UIScreenEdgePanGestureRecognizer()
            {
                Edges = UIRectEdge.Left
            };

            screenEdgePanGestureRecognizer.AddTarget(() => SlideToOpenMasterViewController(screenEdgePanGestureRecognizer));

            View.AddGestureRecognizer(screenEdgePanGestureRecognizer);

            if (DetailViewController == null)
            {
                return;
            }

            AttachDetaiViewController();
        }
        public override IUIViewControllerAnimatedTransitioning GetAnimationControllerForOperation(
            UINavigationController navigationController, UINavigationControllerOperation operation, UIViewController fromViewController, UIViewController toViewController)
        {
            //TODO: remove dependency on CitySelectViewController with interface or something else
            if (operation == UINavigationControllerOperation.Push && fromViewController is HomePageController vc1)
            {
                //Recognizer is added only on push so that user can interactively pop the presented screen.
                var recognizer = new UIScreenEdgePanGestureRecognizer();
                recognizer.Edges = UIRectEdge.Left;
                recognizer.AddTarget(() =>
                {
                    HandleRecognizer(recognizer, navigationController);
                });
                toViewController.View.AddGestureRecognizer(recognizer);
                return(new CustomTransition(operation, vc1.AnimationSourceView));
            }
            else if (operation == UINavigationControllerOperation.Pop && toViewController is HomePageController vc2)
            {
                return(new CustomTransition(operation, vc2.AnimationSourceView));
            }

            return(null);
        }