Open Pranoy1c opened 1 year ago
I was able to solve it. Though I am not sure why the behavior is different between the UITableViewCell and ASCellNode. @appleguy can you help point out why the difference?
In the PhotoCellNode.m
, I returned [super gestureRecognizerShouldBegin:gestureRecognizer]
in gestureRecognizerShouldBegin
and I also added the shouldRecognizeSimultaneouslyWithGestureRecognizer
function:
- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer{
if (gestureRecognizer == _panGestureRecognizer) {
CGPoint v = [_panGestureRecognizer velocityInView:_panGestureRecognizer.view];
return fabs(v.x) > fabs(v.y);
}
return [super gestureRecognizerShouldBegin:gestureRecognizer];
}
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer{
return false;
}
I am using the Texture/AsyncDisplayKit library:
https://github.com/texturegroup/texture
I am trying to implement "swipe to perform action" in a
ASCellNode
. The problem is that theUIPanGestureRecognizer
prevents the table from scrolling.I am able to successfully get this to work in
UIKit
usingUITableViewCell
but for some reason it's not working when using Texture'sASCellNode
. I can demonstrate the issue easily with theASDKgram
example provided with this library which has both aUIKit
example in one tab andTexture
example in another tab:https://github.com/TextureGroup/Texture/tree/master/examples/ASDKgram
For the UIKit example, all I had to do was:
Add
<UIGestureRecognizerDelegate>
toPhotoTableViewCell.h
Add
UIPanGestureRecognizer *_panGestureRecognizer;
in the@implementation PhotoTableViewCell
Add following to the
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
:Add following:
This was enough to get it to print
Panned!
when panning horizontally and also let the UITableView scroll when it's vertical direction.The same does not work for the
PhotoCellNode
. I did the following:Add
<UIGestureRecognizerDelegate>
toPhotoCellNode.h
Add
UIPanGestureRecognizer *_panGestureRecognizer;
in the@implementation PhotoCellNode
Add following to the
PhotoCellNode.m
:This allows
Panned!
to print when panning horizontally but the table does not scroll at all. Why are they working differently? How can I make the table scroll when the touches are vertical?