Iphone 将调用Superview的UILongPressGestureRecognitor而不是Subview
Iphone 将调用Superview的UILongPressGestureRecognitor而不是Subview,iphone,objective-c,ios,uigesturerecognizer,Iphone,Objective C,Ios,Uigesturerecognizer,我有个奇怪的问题。我得到了一个以customcontrols作为子视图的Superview。 它们在superview和SubView中都是手势识别器。 如果我点击子视图,其手势识别器将被调用,点击superview时,其点击将被调用。 但在子视图中长按时,有时会调用superview的手势识别器。我在相同的功能中添加了手势识别器,但态度不同。 超级视图 UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] in
我有个奇怪的问题。我得到了一个以customcontrols作为子视图的Superview。 它们在superview和SubView中都是手势识别器。
如果我点击子视图,其手势识别器将被调用,点击superview时,其点击将被调用。
但在子视图中长按时,有时会调用superview的手势识别器。我在相同的功能中添加了手势识别器,但态度不同。
超级视图
UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapPiece:)];
tapGesture.numberOfTapsRequired = 1;
//contenView is the area where my controls can be
[self.contentView addGestureRecognizer:tapGesture];
[tapGesture release];
UILongPressGestureRecognizer *longTapGesture = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(longTapPiece:)];
tapGesture.numberOfTapsRequired = 1;
[self.contentView addGestureRecognizer:longTapGesture];
[longTapGesture release];
子视图
UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(selectPiece:)];
tapGesture.numberOfTapsRequired = 1;
[self addGestureRecognizer:tapGesture];
UILongPressGestureRecognizer *longPressGesture = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(longPiece:)];
longPressGesture.numberOfTapsRequired = 1;
[self addGestureRecognizer:longPressGesture];
有人能告诉我为什么龙腾不响应我的子视图以及如何修复它。谢谢找到了解决方案,但这不是我想要的,我将控件的持续时间设置为低于superview的持续时间
[LongPress手势设置MinimumPressDuration:0.4]代码>但是手势识别器应该是独立的得到了一个解决方案,但这不是我想要的,我将控件的持续时间设置为低于superview的持续时间[LongPressPirpose setMinimumPressDuration:0.4]代码>但是手势识别器应该是独立的得到了一个解决方案,但这不是我想要的,我将控件的持续时间设置为低于superview的持续时间[LongPressPires setMinimumPressDuration:0.4]
但是手势识别器应该是独立的Hello我遇到了与您相同的问题。请看:得到了一个解决方案,但这不是我想要的,我将控件的持续时间设置为低于superview的持续时间[LongPressPicture setMinimumPressDuration:0.4]
但是手势识别器应该是独立的Hello我遇到了与您相同的问题。请参阅: