2
我有一個UIView和它敲擊手勢識別:爲什麼輕擊手勢識別器能夠識別父視圖上的視圖中的輕敲?
UIImageView *tabView = [[UIImageView alloc] initWithFrame:CGRectMake(41, 145, 702, 100)];
tabView.image = [UIImage imageNamed:@"inactive_tab"];
tabView.userInteractionEnabled = YES;
UITapGestureRecognizer *singleFingerTap =
[[UITapGestureRecognizer alloc] initWithTarget:self
action:@selector(handleSingleTap:)];
[tabView addGestureRecognizer:singleFingerTap];
[self.scrollView addSubview:tabView];
我上添加滾動視圖另一種觀點認爲:
[self.scrollView addSubview:self.activeTab];
activeTab是在inactiveTap。當我點擊activeTap時,手勢識別器發出火,但我不想發生。我怎樣才能避免這種情況?