我想在UITableViewController中尝试tableView添加一个UIPanGestureRecognizer 但如果我添加
- (void)viewDidLoad {
// code
UIPanGestureRecognizer *gestureRecognizer = nil;
gestureRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(handlePan:)];
gestureRecognizer.maximumNumberOfTouches = 1;
gestureRecognizer.delegate = self;
gestureRecognizer.cancelsTouchesInView = NO;
[self.tableView addGestureRecognizer:gestureRecognizer];
// code
}
然后整个表没有响应任何手势,除了一个 - 我的 例如:不滚动手势
是否可以解决UITableViewController的这个问题?
答案 0 :(得分:0)
如果我说得对,你想让桌面视图可以滚动但仍能识别出平移手势吗?
您是否尝试过UIGestureRecognizerDelegate
?
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer
{
return YES;
}