Newly added tableview cells are hidden upon bounce back

228 views Asked by At

I have a UITableview that is populated by a REST web service. I have bouncing enabled so that I can trigger a call to the server with

- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate 

Using this method the call gets triggered when the user lifts their finger after trying to scroll past the bottom of the tableView. The view then bounces back and the new cells are added. The problem I have is that it is not obvious anything was added. The tableView bounces back to the bottom of the screen and it isn't until the user tries to scroll again that the new cells become visible. Here is the method I use to trigger the call.

- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate 
{
    NSInteger currentOffset = scrollView.contentOffset.y;
    NSInteger maximumOffset = scrollView.contentSize.height - scrollView.frame.size.height;

    if (maximumOffset - currentOffset <= -40) 
    {
        if (scrollView == _feedTableView) 
        {
            //This method has a call to the server and adds the new cells to the table
            [self loadFeed:feedRefreshControl];
        }
    }
}

I tried turning off bouncing after the trigger in an attempt to get the bottom cell to remain where it was when the user lifts their finger but the last cell just shoots back to the bottom in an non-animated way.

Any ideas would be appreciated!

1

There are 1 answers

1
Jeffery Thomas On

In the past, I've used a fake last cell which held a spinner. As the user scrolls down to the end of the list, they see the spinner cell as the last cell. When more data is added the spinner cell gets replaced with the first cell of the new data. This is an obvious visual clue to the user that more information has been loaded into the list. I also flashed the status bar, again just a visual cue to the user that the data has been updated.