COCOS2D-iPhone – Proper Sliding Gestures IOS

I cannot find a tutorial on how to properly set up the iOS gesture recognizer.
I need to detect the callback to them.

Any help is appreciated. thanks.

You need two recognizers, one for sliding and the other for scanning:

UISwipeGestureRecognizer* swipeUpGestureRecognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleSwipeUpFrom:)];
swipeUpGestureRecognizerDirectionUp; UISwipeGestureRecognizerDirectionUp; UISwipeGestureRecognizer alloc >

For the handler:

- (void)handleSwipeUpFrom:(UIGestureRecognizer*)recognizer {

}

Finally, you add it to your view:

[view addGestureRecognizer:swipeUpGestureRecognizer];

For the other direction (just move all up To Downs) is the same.

I cannot find a tutorial on how to properly set up the iOS gesture recognizer.
I need to detect the callback to them.

Any help is appreciated. thanks.

You need two recognizers, one for sliding and the other for scanning:

UISwipeGestureRecognizer* swipeUpGestureRecognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleSwipeUpFrom:)];
swipeUpGestureRecognizer.direction = UISwipeGestureRecognizerDirectionUp;

- (void)handleSwipeUpFrom:(UIGestureRecognizer*)recognizer {

}

Finally, you add it to your view:

[view addGestureRecognizer:swipeUpGestureRecognizer];

For the other direction (just raise all to Downs) the same.

Leave a Comment

Your email address will not be published.