使用UIScrollView自定义UITableViewCell

问题描述:

当UITableViewCell中存在UIScrollView时,单元不会接收到触摸事件。有什么办法可以取消UIScrollView的tap事件(只需要处理滚动)?使用UIScrollView自定义UITableViewCell

如果你需要触摸穿过去,落实的UIScrollView的子类,并添加这些:

- (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]; 
} 

细胞只interecepts水龙头,所以它会工作。

+0

您的解决方案刚刚拯救了我的一天!谢谢! – 2012-10-24 13:26:26

这太棒了!我在这个上拉我的头发。