Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to stop scrolling of a scrolling UITableview programmatically

    • 0
    • 1
    • 1
    • 0
    • 0
    • 0
    • 0
    • 0
    • 3.13k
    Comment on it

    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)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: