Skip to content

Instantly share code, notes, and snippets.

@rscarvalho
Created January 18, 2013 00:36
Show Gist options
  • Select an option

  • Save rscarvalho/4561259 to your computer and use it in GitHub Desktop.

Select an option

Save rscarvalho/4561259 to your computer and use it in GitHub Desktop.
- (void)viewDidLoad
{
[super viewDidLoad];
[[WPApi sharedApi]
getPostsWithSuccess:^(NSArray *entries) {
self.posts = entries;
[self.tableView reloadData];
}
failure:^(NSError *error) {
[[[UIAlertView alloc] initWithTitle:@"Error!"
message:[error localizedDescription]
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil] show];
}];
}
/* ... */
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"post"];
NSDictionary *current = self.posts[indexPath.row];
cell.textLabel.text = [current objectForKey:@"title"];
cell.detailTextLabel.text = [current objectForKey:@"summary"];
return cell;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment