我有一点问题,我尝试拖动一个UITableview,用这段代码拖动一个视图,但我不能拖动一个uitableview,问题出在哪里?
UIPanGestureRecognizer *panGesture = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(handlePan:)];
[self.table addGestureRecognizer:panGesture];
- (void)handlePan:(UIPanGestureRecognizer *)recognizer {
CGPoint translation = [recognizer translationInView:self.view];
recognizer.view.center = CGPointMake(recognizer.view.center.x + translation.x, recognizer.view.center.y + translation.y);
[recognizer setTranslation:CGPointMake(0, 0) inView:self.view];
[self.view bringSubviewToFront:recognizer.view];
}
我在iPad应用程序上工作
答案 0 :(得分:0)
你的桌子是弹跳还是滚动?然后它意味着你的桌子的滚动触摸,你不会得到它。观察表的滚动委托并在那里实现相同的代码。它会起作用。