0

I am trying to load the table at the bottom of the scrolling view instead of the top. I used this code but it's loading the table at the top.

- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView {
    float bottomEdge = scrollView.contentOffset.y + scrollView.frame.size.height;
    if (bottomEdge >= scrollView.contentSize.height) {
        if ((isloading = true)) {
            pageno= pageno+1;
            [self fetchdata];
            [self.tableview reloadData];
        }
    }
}
Synchro
  • 35,538
  • 15
  • 81
  • 104
  • add data at the end in your data array – Shoaib Jan 12 '15 at 07:47
  • Show the code for fetch data – Wain Jan 12 '15 at 07:49
  • Here no need to use `scrollViewDidEndDecelerating` method. Search answer for load more concept in `UITableView` will your best match. Like - http://stackoverflow.com/questions/20269474/uitableview-load-more-when-scrolling-to-bottom-like-facebook-application – Kampai Jan 12 '15 at 07:51

1 Answers1

0

UITableView inherit from UIScrollView. You can use the property contentSize to get the height of the content, then you can use

- (void)scrollRectToVisible:(CGRect)rect animated:(BOOL)animated

or, if you know which is your last row

- (void)scrollToRowAtIndexPath:(NSIndexPath *)indexPath atScrollPosition:(UITableViewScrollPosition)scrollPosition animated:(BOOL)animated

Apple Documentation

Luca D'Alberti
  • 4,749
  • 3
  • 25
  • 45