When we are having multiple tableviews with a common datasource we must make sure that only one table view is being reloaded at a time. We cannot load data on one table while other is scrolling as it would invoke datasource methods for the scrolling tableview. So either we need to wait till the scrolling tableview stops scrolling or we stop the scrolling forcefully.
By using following code we can programmatically stop the scroll of a UITableView which is scrolling :
if (tableView.isDecelerating) {
NSArray *paths = [tableView indexPathsForVisibleRows];
[tableView scrollToRowAtIndexPath:[paths objectAtIndex:0] atScrollPosition:UITableViewScrollPositionTop animated:NO];
}
0 Comment(s)