As I continue to dive into iOS development, I’m on the lookout for time saving Cocoa projects. Sam’s SSPullToRefresh is an easy, customizable way to add pull-to-refresh views like those made popular in Loren Brichter’s original Tweetie for iPhone app. SSPullToRefresh hides all the pulling and animating logic away, leaving you to implement what you care about – fetching and refreshing your view.

- (void)viewDidLoad {
   [super viewDidLoad];
   self.pullToRefreshView = [[SSPullToRefreshView alloc] initWithScrollView:self.tableView delegate:self];
}


- (void)refresh {
   [self.pullToRefreshView startLoading];
   // Load data...
   [self.pullToRefreshView finishLoading];
}

- (void)pullToRefreshViewDidStartLoading:(SSPullToRefreshView *)view {
   [self refresh];
}

You can use a couple of provided content views or you can subclass and implement your own. Check out the source on GitHub or see it in action in Cheddar.


Have comments? Send a tweet to @TheChangelog on Twitter.

Subscribe to The Changelog Weekly – our weekly email covering everything that hits our open source radar.