2011-11-17 179 views
1

我有一個UITableView作爲UIViewController的視圖中的子視圖檢測多點觸摸。我知道我可以通過overwritting在一個自定義的UIViewController包含一個UITableView子視圖

-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event 
{ 
    [super touchesBegan:touches withEvent:event]; 
} 

-(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event 
{ 
    [super touchesEnded:touches withEvent:event]; 
} 

-(void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event 
{ 
    [super touchesCancelled:touches withEvent:event]; 
} 
-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event 
{ 
    [super touchesMoved:touches withEvent:event]; 
} 

檢測觸摸事件,但如果我觸摸tableview它永遠不會檢測到這些事件的ViewController。在本次論壇由別人的建議,我應該有一個自定義UITableView,並在其中添加上述行。我這樣做,但仍是viewController沒有檢測到觸摸事件。有什麼建議麼?謝謝。

回答

1

谷歌搜索後的幾天,我終於找到了我的作品的解決方案。關鍵是將響應者鏈傳遞給下一個響應者。例如,在觸摸開始的情況下,添加以下行。 [self.nextResponder的touchesBegan:觸摸withEvent:方法事件]

相關問題