问题描述
|
我尝试了以下代码:
UISwipeGestureRecognizer *showBar = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(gestureShowBar:)];
showBar.direction = UISwipeGestureRecognizerDirectionDown;
showBar.numberOftouchesrequired = 2;
[self.tableview addGestureRecognizer:showBar];
没有运气!当我用两根手指滑动时,tableview倾向于滚动。因此,我尝试在tableview上禁用多点触摸,然后让superview处理手势:
UISwipeGestureRecognizer *showBar = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(gestureShowBar:)];
showBar.direction = UISwipeGestureRecognizerDirectionDown;
showBar.numberOftouchesrequired = 2;
[self.view addGestureRecognizer:showBar];
再次,它不起作用!我真的很想知道,即使未启用多点触摸,为什么表视图也会响应两指滑动!
解决方法
此链接描述了如何在表格行中实现捏合手势,您可以调整滑动手势来代替
检出存在夹点方法的tableviewcontroller类
http://developer.apple.com/library/ios/#samplecode/TableViewUpdates/Introduction/Intro.html#//apple_ref/doc/uid/DTS40010139
祝好运