Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how handle left/right swipes? #12

Open
icanzilb opened this issue Oct 6, 2012 · 4 comments
Open

how handle left/right swipes? #12

icanzilb opened this issue Oct 6, 2012 · 4 comments

Comments

@icanzilb
Copy link

icanzilb commented Oct 6, 2012

If there's only one swiper attached to a box, how to handle left AND right swipes?

@icanzilb
Copy link
Author

icanzilb commented Oct 6, 2012

I meant - is it a more common case that a box can be swiped in only 1 direction? Does it not make more sense to have 4 recongizers attached to the box, and onSwipe to receive as a param the current direction for example?

@sobri909
Copy link
Owner

sobri909 commented Oct 6, 2012

MGBox is providing a standard unmodified UISwipeGestureRecognizer. You'll want to configure the direction property:

http://developer.apple.com/library/ios/#DOCUMENTATION/UIKit/Reference/UISwipeGestureRecognizer_Class/Reference/Reference.html#//apple_ref/occ/instp/UISwipeGestureRecognizer/direction

My preference would be for swipe gesture recognisers to optionally allow multiple swipe directions. I think the way Apple have done it is unnecessarily limiting. But certainly you could get around it by attaching additional recognisers and setting their action to the swiped method.

Alternatively MGBox could be modified to have onSwipedRight, onSwipedLeft, etc. That might be the better path, because it would make it explicit which direction the swipe was in.

@icanzilb
Copy link
Author

icanzilb commented Oct 7, 2012

Yeah, same direction of thought that I have ... like for my current project I just attached another gesture recogniser to the same box, but I realized I can't use the same onSwipe block to handle both, because then I don't know which direction the swipe was ...

I think onSwipedRight, onSwipedLeft, etc. is the right way

@sobri909
Copy link
Owner

An idea that just occurred to me, and that hasn't been thought out at all, so might be really stupid, is that all the gesture and tap handlers could be moved to a UIView category, thus decoupling them from MGBox and making them much more broadly usable.

Something to think about.

Anyway, the next time the onSwipe left/right limitation hits me I'll get that one fixed. It's silly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants