0

我有一个 UISwipeGestureRecognizer 在我的视图控制器上工作。如果我向左滑动或向右滑动,我会负责加载另一个视图并将其显示在屏幕上。

如何添加过渡。视图正在加载在处理转换的主 ViewController 内的 ScrollView 中。

        MonoTouch.UIKit.UISwipeGestureRecognizer sgrLeft = new MonoTouch.UIKit.UISwipeGestureRecognizer();
        MonoTouch.UIKit.UISwipeGestureRecognizer sgrRight = new MonoTouch.UIKit.UISwipeGestureRecognizer();

        // add the target to it, we put the instance itself of the controller 
        // and the class instance selector
        sgrLeft.AddTarget(this, new Selector("HandleSwipe"));
        sgrRight.AddTarget(this, new Selector("HandleSwipe"));

        // add the swipe direction, there are 4 of them (left, right, up, down). If other than one swipe is 
        // needed then more recognizers must be defined and added to the view - each for the direction
        sgrLeft.Direction = UISwipeGestureRecognizerDirection.Left; 
        sgrRight.Direction = UISwipeGestureRecognizerDirection.Right; 
        // also assign the delegate
        sgrLeft.Delegate = new Helpers.SwipeRecognizerDelegate();
        sgrRight.Delegate = new Helpers.SwipeRecognizerDelegate();

        // and last, add the recognizer to this view to take actions
        this._scrollView.AddGestureRecognizer(sgrLeft);
        this._scrollView.AddGestureRecognizer(sgrRight);
4

0 回答 0