2011-02-24 78 views
0

我用两个手指同时触摸。我得到[touches count] => 1和[[event allTouches] count] => 2touchesbegan触摸即使用两个手指也只注册一个触摸

我不应该得到2他们两个?

此外,当我第一次放置1个手指,然后另一个在同一个单元格上。第二手指事件不会导致触摸开始到Drigger?它不应该叫touchesBegan两次?

我已经在这里我设置一个表格单元格:

multipleTouchEnabled = YES; 

这里我倒是开始:

-(void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{ 
    NSLog(@"began touch count %d", [touches count]); 
    NSLog(@"all touches %d", [[event allTouches] count]); 
} 

回答

2

似乎有使用UITableViewCell时将一些事情与触摸。我的猜测是,这与内置的检测单元的触摸和触摸处理以及能够处理UITableView本身的滚动有关。作为一种解决方法,您可以将自己的视图添加到单元的contentView,以便能够检测到触摸。沿着线的东西:

MyCustomView *customView = [[MyCustomView alloc] initWithFrame:...]; 
customView.multipleTouchEnabled = YES; 
[cell.contentView addSubview:customView]; 
[customView release]; 

在其中创建的细胞,可能是在tableView:cellForRowAtIndexPath: