JTRevealSidebarDemo
JTRevealSidebarDemo copied to clipboard
Added pan gesture, tap gesture, swip gesture to the side bar
I added pan gesture, tap gesture, swip gesture to the side bar, just some small changes.
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
@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.
@wkopen Just added the pan gesture to open the side bar, as well as close the side bar, you could take a look. Thanks!
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? :+1: @cyndibaby905
@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;
}