Skip to content

Instantly share code, notes, and snippets.

@hsjunnesson
Created November 13, 2013 15:07
Show Gist options
  • Save hsjunnesson/7450562 to your computer and use it in GitHub Desktop.
Save hsjunnesson/7450562 to your computer and use it in GitHub Desktop.
How to programmatically scroll a tableview to the top, then run a block when it's done animating. #ReactiveCocoa
[[[RACObserve(self.tableView, contentOffset)
filter:^BOOL(NSValue *contentOffset) {
CGPoint point = [contentOffset CGPointValue];
return point.y == 0.0f;
}]
take:1]
subscribeCompleted:^{
// This block gets executed when the tableview has scrolled to top
}];
[self.tableView scrollRectToVisible:CGRectMake(0, 0, 1, 1) animated:YES];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment