拖动 UITableView
我有一个小问题,我尝试拖动 UITableview,在这段代码中我拖动了视图,但无法拖动 uitableivew,问题出在哪里?
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 应用程序工作
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的桌子会弹跳或滚动吗?那么这意味着你的桌子的滚动条受到了触摸,而你却无法得到它。观察表的滚动委托并在那里实现相同的代码。它会起作用的。
Does your table bounce or scroll? Then it means your table's scroll takes the touch and you won't get it. Observe your table's scroll delegate and implement the same code there. It will work.