title: UITableView Load More Cells At Bottom, Method Getting Called Multiple Times
body: <p>I am working on a simple iPhone app that is loading data from the web service (RSS feed) inside UITableView. The first time app is loading, i am using a counter with initial value of 1 to load the first page of the feed:</p>
  
  <pre><code>- (void)viewDidLoad
  {
      [super viewDidLoad];
      counter = 1;    
      [self fetchEntriesNew:counter];
  } 
  </code></pre>
  
  <p>When the user scrolls down to the bottom of tableview, i am using the following method to load more data in the tableview by fetching the next page of rss feed by incrementing the counter:</p>
  
  <pre><code>- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView
  {
      float endScrolling = scrollView.contentOffset.y + scrollView.frame.size.height;
      if (endScrolling &gt;= scrollView.contentSize.height)
      {       
          NSLog(@"Scroll End Called");
          counter++;
          [self fetchEntries:counter];
      }
  }
  </code></pre>
  
  <p>The counter is incrementing each time user scrolls down to the bottom of tableview, hence calling the next page of the rss feed. To this point, everything is working fine.</p>
  
  <p>BUT, if the user after reaching at the bottom, scrolls up multiple times, the counter also gets incremented multiple times, hence a different page of the rss feed is reached and added to the bottom of the tableview.</p>
  
  <p>To be more precise, if the user has reached to the bottom and scrolled up 3 times, instead of loading the second page, it will load the fourth page (3 times scrolled plus 1 already added in the start)</p>
  
  <p><strong>How can i restrict to not add another page entries if the one before it was not loaded?</strong></p>
  
  <p>Kindly do not suggest alternative strategies for handling more rows at the bottom of tableview or any third party libraries like NMPaginator and PartialTable etc. Thanks in advance!</p>
  
  <p><strong>UPDATE:</strong></p>
  
  <p>I have closely observed the app by running it again and again. It seems like if the user scrolls to the bottom (that increments the counter) before tableview is finished loading the page data (including images) that is already requested, it will just ignore loading the one that is currently loading and start loading the next one based on the incremented counter.</p>