Created
November 13, 2013 15:07
-
-
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
This file contains 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
[[[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