2013-04-12 38 views
0

内一个UITableView我有一个自定义单元格,并添加一个的viewController作为一个子视图到该小区:滚动一个tableViewCell

TestViewController *vc = [[TestViewController alloc] initWithNibName:@"TestViewController" bundle:nil]; 
[self addSubview:vc.view]; 

新的viewController中有一个的tableView。当我尝试滚动tableView时,自定义单元格所在的基本tableView正在滚动。

我该如何解决这个问题?

在此先感谢

+0

这与'xcode IDE'或'C'有什么关系? – Popeye

+2

我不确定它可以完成,我不认为这会是一个很好的用户体验,但我会说你是否在单元格中设置了'UITableView'的委托? – Popeye

回答

3

我会建议反对然而嵌入tableviews如果你真的想这样做的,该解决方案很可能会实现基本tableViewhitTest方法:

-(UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event { 

    //here you will need to check if the point lies within any of the 
    //child tableviews and return it .. else return the super method 

    if ([self pointInChildTable:point]) { 
     return [self childTableForPoint:point]; 
    } 
    return [super hitTest:point withEvent:event]; 
} 

请注意,pointInChildTablechildTableForPoint应该可能是返回带结果的字典的相同方法。我将它们分开仅作解释。

希望这会有所帮助。

+0

完全同意嵌入'UITableView'并不是一个好主意,但是像'hitTest:withEvent:'这样的想法+1。 – Popeye