开发者

How to recognize diagonal swipes on the screen?

开发者 https://www.devze.com 2023-01-17 20:06 出处:网络
I\'m using UISwipeGestureRecognizer successfully to capture and action when gestures on the screen are made with single or multiple touches in Up, down left or right directions using the standard tool

I'm using UISwipeGestureRecognizer successfully to capture and action when gestures on the screen are made with single or multiple touches in Up, down left or right directions using the standard tools.

However what I really need to do now is have the device recognize d开发者_如何学Ciagonal swipes in the same way. Does anyone have any ideas where to start? Do I simply subclass UIGestureRecognizer myself and try to work out how to roll my own UIDiagonalSwipeRecognizer? Or is there a way of detecting if a swipe is, say, up && left?

Your help is appreciated...


I'd simply use an oldschool "touchesBegan" and "touchesEnded" and there check the x and y delta, if both of them is greater then some minimum constant, then this swipe should be a diagonal one.

Correct me if I wrong but UISwipeGestureRecognizer available from iOS 3.2 only, and if so that is not an advantage.

0

精彩评论

暂无评论...
验证码 换一张
取 消