예제 #1
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            View.BackgroundColor = UIColor.Clear;

            Front = new FrontView(verses[0]);
            View.BackgroundColor = UIColor.FromPatternImage(Images.TableViewBackground);

            Back = new BackView(verses[position]);

            MemorizedImage    = Images.HeartRedButton;
            NotMemorizedImage = Images.HeartGreyButton;

            TapGesture = new UITapGestureRecognizer {
                NumberOfTapsRequired = 1
            };
            TapGesture.AddTarget(TapHandler);

            SwipeUpGesture = new UISwipeGestureRecognizer {
                Direction = UISwipeGestureRecognizerDirection.Up
            };
            SwipeUpGesture.AddTarget(FlipCardHandler);

            SwipeDownGesture = new UISwipeGestureRecognizer {
                Direction = UISwipeGestureRecognizerDirection.Down,
            };
            SwipeDownGesture.AddTarget(FlipCardHandler);

            SwipeUpTwoFingersGesture = new UISwipeGestureRecognizer {
                Direction = UISwipeGestureRecognizerDirection.Up,
                NumberOfTouchesRequired = 2
            };
            SwipeUpTwoFingersGesture.RequireGestureRecognizerToFail(SwipeUpGesture);
            SwipeUpTwoFingersGesture.AddTarget(NextCardHandler);

            SwipeDownTwoFingersGesture = new UISwipeGestureRecognizer {
                Direction = UISwipeGestureRecognizerDirection.Down,
                NumberOfTouchesRequired = 2,
            };
            SwipeDownTwoFingersGesture.RequireGestureRecognizerToFail(SwipeDownGesture);
            SwipeDownTwoFingersGesture.AddTarget(NextCardHandler);

            RightSwipeGesture = new UISwipeGestureRecognizer {
                Direction = UISwipeGestureRecognizerDirection.Right
            };
            RightSwipeGesture.AddTarget(RightSwipeHandler);

            View.Add(Front);
            View.AddGestureRecognizer(SwipeUpGesture);
            View.AddGestureRecognizer(SwipeDownGesture);
            View.AddGestureRecognizer(SwipeUpTwoFingersGesture);
            View.AddGestureRecognizer(SwipeDownTwoFingersGesture);
            View.AddGestureRecognizer(RightSwipeGesture);
            View.AddGestureRecognizer(TapGesture);
        }