Created
July 20, 2016 20:23
-
-
Save thornpig/d09094c7f99334c6e2b5968570e0a101 to your computer and use it in GitHub Desktop.
Control the scroll speed when hiding refresh control in table view
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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