1

I'm working on an iOS project where I want to dynamically add more cell to the bottom of the tableview once the user reaches the bottom. I currently have this working by calling a method that fetches more data that is added to the array that I'm using to hold my cells. When I'm done adding the objects to the array I call [tableView reloadData]. This works, but it doesn't visually load the cell until the tableview stops scrolling.

I also tried using [tableView insertRowsAtIndexPaths: inSection:withRowAnimation: UITableViewRowAnimationNone]. But I was getting very strange behavior where random cell would disappear and not show back up until I scrolled that section of the tableView off screen and then back to that area.

Is there a way to get the tableView to reload even if the tableView is still in mid scroll when the [tableView reloadDate] is called?

Thank you!

KevinM
  • 1,799
  • 4
  • 28
  • 58
  • 1
    Did you try this http://stackoverflow.com/questions/5137943/how-to-know-when-uitableview-did-scroll-to-bottom ? – JiaYow Mar 20 '12 at 12:32
  • No I have seen that one yet, but I think it is exactly what I was looking for. I'll try it out. Thank you! – KevinM Mar 20 '12 at 12:40
  • That matches my experience. The table contents is not updated until the talbe stops scrolling. I have seen that in other apps too. Therfore I thought that this is 'as is'. If there is any trick to change that, I'd be greateful too. – Hermann Klecker Mar 20 '12 at 12:45
  • I Just added the - (void)scrollViewDidScroll:(UIScrollView *)aScrollView { delegate call from http://stackoverflow.com/questions/5137943/how-to-know-when-uitableview-did-scroll-to-bottom . I changed the called to fetch more cell right after the NSLog(@"load more rows");. It works perfectly now! Thanks JiaYow!!! – KevinM Mar 20 '12 at 12:49

1 Answers1

2

Check out: How to know when UITableView did scroll to bottom in iPhone neoneye's answer about - (void)scrollViewDidScroll:(UIScrollView *)aScrollView { was exactly what I was looking for. I moved the method call to fetch more cell right after the NSLog(@"load more rows");

Thank you JiaYow for steering me in the right direction!

Community
  • 1
  • 1
KevinM
  • 1,799
  • 4
  • 28
  • 58