2012-03-19 73 views
0

我想在superview中處理觸摸事件,當有兩個觸摸着陸在不同子視圖上時。識別兩個觸摸點擊兩個不同的子視圖

我可以通過將UITapGestureRecognizernumberOfTouchesRequired =2;與目標self添加到子視圖嗎?

或者我需要去更復雜的東西?

回答

0

你可以嘗試這樣的事:

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { 
UITouch *touch = touches.anyObject; 
CGPoint referencePoint = [touch locationInView:self.view]; 

if([touch tapCount] == 2){ 
     //Test touch coordinates to see if theres one in each view 
}