Created
January 18, 2013 00:36
-
-
Save rscarvalho/4561259 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| - (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