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

Added pan gesture, tap gesture, swip gesture to the side bar #28

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

cyndibaby905
Copy link

I added pan gesture, tap gesture, swip gesture to the side bar, just some small changes.

Added pan gesture, tap gesture, swip gesture to the side bar
@wkopen
Copy link

wkopen commented Feb 16, 2013

Hi, I add your codes into the controller file and run without any error. But I can't really see the touch/pan/swipe functions functioning. Is there anything I forgot to do? Thx for your help! The gesture recognition thing is really what I'm looking for. @cyndibaby905

@cyndibaby905
Copy link
Author

@wkopen The pan, swipe and tap gestures are been added when the side bar will show, which means only when you taped on the navigation button, will those gestures become effective(Like what Yahoo! mail does). You can use those gestures to close the side bar. It is easy to add other gestures to open the side bar, and I will show you the code later.

Added pan gesture to open the side bar
@cyndibaby905
Copy link
Author

@wkopen Just added the pan gesture to open the side bar, as well as close the side bar, you could take a look. Thanks!

@wkopen
Copy link

wkopen commented Feb 16, 2013

Thanks for your quick reply! But there are some problems that I think we still need to deal with, here is a critical one which I currently have no idea how to implement it :
[1] When you apply the gesture recognition thing to "viewcontroller.m" in V2. The contents in the viewController cannot be clicked (instead, the program will think that this click is to drag the slide bar). So I cannot access the table cell content in my "viewcontroller.m".

I think we can add "tap" gesture to tell the program what to do or not to do when we tap the screen. But I don't know how are we actually going to implement it (I'm still a rookie). Can you take some time to improve this? 👍 @cyndibaby905

@cyndibaby905
Copy link
Author

@wkopen You could take a look at the UIGesture's delegate:

- (BOOL)gestureRecognizerShouldBegin:(UIPanGestureRecognizer *)gestureRecognizer;

You can return YES only when it is a horizontal swipe, such as:

- (BOOL)gestureRecognizerShouldBegin:(UIPanGestureRecognizer *)gestureRecognizer
{
    UIView *cell = [gestureRecognizer view];
    CGPoint translation = [gestureRecognizer translationInView:cell];
    // Check for horizontal gesture
    if (fabsf(translation.x) > fabsf(translation.y))
    {
        return YES;
    }
   return NO;
}

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

Successfully merging this pull request may close these issues.

2 participants