UIGestureRecognizerをuiview階層の奥深くに配置しましたが、トリガーされていません。ビューの一般的なマップは次のとおりです。
UIScrollView> UIView> UIView> UIView> UIView
最後のビューにはジェスチャレコグナイザーがあります。
- (id)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if (self) {
self.userInteractionEnabled = TRUE;
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tap:)];
[self addGestureRecognizer:tap];
[tap release];
}
return self;
}
- (void)tap:(UIGestureRecognizer *)recognizer {
NSLog(@"tap");
}
canCancelContentTouches
ジェスチャが伝播できるようにスクロールビューのを設定しています。
ジェスチャを使用してビューをスクロールビューの真下に移動すると、機能します。なぜそれが深い階層で機能しないのか誰かが説明できますか?
ありがとう!