Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save thornpig/d09094c7f99334c6e2b5968570e0a101 to your computer and use it in GitHub Desktop.
Save thornpig/d09094c7f99334c6e2b5968570e0a101 to your computer and use it in GitHub Desktop.
Control the scroll speed when hiding refresh control in table view
//need double animation blocks
if (self.tableView.contentInset.top == 0)
{
UIEdgeInsets tableViewInset = self.tableView.contentInset;
tableViewInset.top = -1.*kTableHeaderHeight;
[UIView animateWithDuration: 0 animations: ^(void){} completion:^(BOOL finished) {
[UIView animateWithDuration: 0.5 animations:^{
//no need to set contentOffset, setting contentInset will change contentOffset accordingly.
self.tableView.contentInset = tableViewInset;
}];
}];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment