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

iDia
  • 1,397
  • 8
  • 25
  • 44

3 Answers3

8

Table view is a scroll view as mentioned here: Is it possible to access a UITableView's ScrollView In Code From A Nib?

So you can just check the scroll view passed in each delegate method whether the scroll view is the table view you want, for example:

- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate{
    if (scrollView == tblSongs) {
        isDragging_msg = FALSE;
        [tblSongs reloadData];
    }
}
Community
  • 1
  • 1
Valent Richie
  • 5,226
  • 1
  • 20
  • 21
0

What do you think scrollView parameter in all these methods is for?

Kreiri
  • 7,840
  • 5
  • 30
  • 36
0

You can detect event on each table. UITableView event

To receive touch events on the UITableView use:

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

and can reload any particular tableview. Thanks

Community
  • 1
  • 1
chandan
  • 2,453
  • 23
  • 31