我以这种方式检测UITableView
滚动
`
- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate: (BOOL)decelerate{
isDragging_msg = FALSE;
[tblSongs reloadData];
}
- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView{
isDecliring_msg = FALSE;
[tblSongs reloadData]; }
- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView{
isDragging_msg = TRUE;
}
- (void)scrollViewWillBeginDecelerating:(UIScrollView *)scrollView{
isDecliring_msg = TRUE; }
`
但我必须加载sevaral UITableViews
在此检测下,我必须单独重新加载每个表。所以我如何检测当前正在滚动的表。
由于
答案 0 :(得分:8)
表视图是这里提到的滚动视图:Is it possible to access a UITableView's ScrollView In Code From A Nib?
因此,您可以检查每个委托方法中传递的滚动视图,无论滚动视图是您想要的表视图,例如:
- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate{
if (scrollView == tblSongs) {
isDragging_msg = FALSE;
[tblSongs reloadData];
}
}
答案 1 :(得分:0)
您认为所有这些方法中的scrollView
参数是什么?
答案 2 :(得分:0)
您可以检测每张桌子上的事件。 UITableView event
要在UITableView上使用触摸事件:
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
//<your stuff>
[super touchesBegan:touches withEvent:event];
}
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
//<your stuff>
[super touchesMoved:touches withEvent:event];
}
- (void)touchesEnded:(NSSet*)touches withEvent:(UIEvent*)event
{
//<your stuff>
[super touchesEnded:touches withEvent:event];
}
- (void)touchesCancelled:(NSSet*)touches withEvent:(UIEvent*)event
{
//<your stuff>
[super touchesCancelled:touches withEvent:event];
}
并可以重新加载任何特定的tableview。感谢