我已经进行了子类化UITableViewCell
,并在该类中应用了平移手势识别器:
UIPanGestureRecognizer *panning = [[UIPanGestureRecognizer alloc]initWithTarget:self action:@selector(handlePanning:)];
panning.minimumNumberOfTouches = 1;
panning.maximumNumberOfTouches = 1;
[self.contentView addGestureRecognizer:panning];
[panning release];
然后我实现了委托协议,该协议应该允许在表格视图中同时使用手势:
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer {
return YES;
}
然后我在方法中放置一个日志,handlePanning
以查看何时检测到它:
- (void)handlePanning:(UIPanGestureRecognizer *)sender {
NSLog(@"PAN");
}
我的问题是我无法垂直滚动表格视图中的单元格列表,handlePanning
无论我平移哪个方向,都会调用它。
我想要的是handlePanning
只在只有水平平移而不是垂直时才被调用。希望得到一些指导。