0

UISwipeGestureRecognizerを認識しUISwipeGestureRecognizerDirectionUp、その直後に、指を離さずに認識機能を認識するにはどうすればよいUISwipeGestureRecognizerDirectionDownですか?

UISwipeGestureRecognizers基本的には、方向を変えるときに指を離さずに複数認識されるようにしたいです。

これまでの私のコード...

    - (void)viewDidLoad {        
        UISwipeGestureRecognizer *swipeUp = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(screenSwipedUp)];
        swipeUp.numberOfTouchesRequired = 1;
        swipeUp.direction = UISwipeGestureRecognizerDirectionUp;
        swipeUp.cancelsTouchesInView = NO;
        [self.view addGestureRecognizer:swipeUp];

        UISwipeGestureRecognizer *swipeDown = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(screenSwipedDown)];
        swipeDown.numberOfTouchesRequired = 1;
        swipeDown.direction = UISwipeGestureRecognizerDirectionDown;
        swipeDown.cancelsTouchesInView = NO;
        [self.view addGestureRecognizer:swipeDown];

    }

    - (void)screenSwipedUp {
        NSLog(@"SW-Up");
    }

    - (void)screenSwipedDown {
        NSLog(@"SW-Down");
    }
4

1 に答える 1

1

UISwipeGestureRecognizer ではできないと思います。代わりにUIPanGestureRecognizerを使用してアクションを実装するか、 UIGestureRecognizerのサブクラスを作成してメソッドをオーバーライドして、特別なジェスチャを認識することができます。

于 2013-04-14T10:29:14.420 に答える