UINavigationItemのtouchViewにビューを設定し、それにタップジェスチャレコグナイザーを追加しています。奇妙なことに、タップがビューの外にある場合でも、タップ認識機能が呼び出されます。なぜこれが起こっているのか考えていますか?
UIView *testView = [[UIView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 120.0f, 20.0f)];
testView.backgroundColor = [UIColor redColor];
UIGestureRecognizer *tapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(doStuff:)];
tapRecognizer.cancelsTouchesInView = YES;
[testView addGestureRecognizer:tapRecognizer];
testView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
self.navigationItem.titleView = testView;
赤いボックスの外側をクリックしても、ジェスチャ認識機能をトリガーできます。