2011-01-31 3 views
0

UITableViewCell内にUIScrollViewがある場合、セルはタッチイベントを受け取りません。 UIScrollViewのタップイベントをキャンセルする方法はありますか(スクロールのみを処理する必要がありますか?)UIScrollViewを使用したカスタムUITableViewCell

答えて

5

あなたは、通過UIScrollViewのサブクラスを実装し、これらを追加するタッチが必要な場合:それがうまくいくように、セルのみ、タップをinterecepts

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event 
{  
    // Pass to parent 
    [super touchesBegan:touches withEvent:event]; 
    [self.nextResponder touchesBegan:touches withEvent:event]; 
} 

- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event 
{ 
    // Pass to parent 
    [super touchesEnded:touches withEvent:event]; 
    [self.nextResponder touchesEnded:touches withEvent:event]; 
} 

+0

あなたのソリューションはちょうど私の一日を保存しました!ありがとう! –

0

これは素晴らしいです!私はこの上に私の髪を引っ張っていた。