5

Im detecting UITableView scrolling in this way

`

  - (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; }

`

but I have to load sevaral UITableViews Under this detection I have to reload each tables seperately. So how I can detect which table is currently scrolling.

Thanks

4

3 回答 3

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];
    }
}
于 2013-05-29T07:17:09.883 回答
0

您认为scrollView所有这些方法中的参数是做什么用的?

于 2013-05-29T07:14:50.653 回答
0

您可以检测每个表上的事件。UITableView 事件

要在 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];
}

并且可以重新加载任何特定的表格视图。谢谢

于 2013-05-29T07:17:40.323 回答