Skip to content

Instantly share code, notes, and snippets.

@ninthspace
Created April 26, 2012 15:20
Show Gist options
  • Save ninthspace/2500316 to your computer and use it in GitHub Desktop.
Save ninthspace/2500316 to your computer and use it in GitHub Desktop.
UITableViewController initializer with support for SVPullToRefresh
- (id)init {
self = [super initWithStyle:UITableViewStyleGrouped];
if (self) {
// add the handler to the UITableView
[[self tableView] addPullToRefreshWithActionHandler:^{
// do something, in this case add a new item to our data source
[self addNewItem:nil];
// tell pull-to-refresh to stop animating
[[[self tableView] pullToRefreshView] stopAnimating];
}];
}
return self;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment