Skip to content

Instantly share code, notes, and snippets.

@stevemoser
Created August 24, 2012 02:06
Show Gist options
  • Save stevemoser/3444720 to your computer and use it in GitHub Desktop.
Save stevemoser/3444720 to your computer and use it in GitHub Desktop.
RestKit post 4
- (void)refreshArticles
{
[SVProgressHUD showWithMaskType:SVProgressHUDMaskTypeGradient];
__weak SMArticlesViewController *me = self;
[[self articlesDataSource] loadArticlesWithOnLoad:^(NSArray *newObjects) {
if (me != nil) {
[me.tableView reloadData];
[SVProgressHUD dismissWithSuccess:nil afterDelay:1];
}
} onError:^(NSError *error) {
[SVProgressHUD dismiss];
UIAlertView* alert = [[UIAlertView alloc] initWithTitle:@"Error" message:[error localizedDescription] delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alert show];
}];
}
##
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [[self articlesDataSource] articleCount];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment