Skip to content

Commit af1339f

Browse files
author
Brian Morton
committed
Register RKGHIssueCell nib with issues table view and hook up to the cellMapping.
1 parent 23f8a89 commit af1339f

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

Code/Controllers/RKGHIssuesTableViewController.m

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,12 @@ - (void)viewDidLoad
3333
self.tableController.autoRefreshFromNetwork = YES;
3434
self.tableController.pullToRefreshEnabled = YES;
3535
self.tableController.resourcePath = @"/repos/RestKit/RestKit/issues";
36+
self.tableController.variableHeightRows = YES;
3637
NSSortDescriptor *descriptor = [NSSortDescriptor sortDescriptorWithKey:@"createdAt" ascending:NO];
3738
self.tableController.sortDescriptors = [NSArray arrayWithObject:descriptor];
3839

40+
[self.tableView registerNib:[UINib nibWithNibName:@"RKGHIssueCell" bundle:nil] forCellReuseIdentifier:@"RKGHIssue"];
41+
3942
// TODO: Add a loading view...
4043

4144
/**
@@ -46,9 +49,14 @@ - (void)viewDidLoad
4649
render the tableView.
4750
*/
4851
RKTableViewCellMapping *cellMapping = [RKTableViewCellMapping cellMapping];
49-
cellMapping.reuseIdentifier = @"RKGHIssueCell";
50-
[cellMapping mapKeyPath:@"title" toAttribute:@"textLabel.text"];
51-
[cellMapping mapKeyPath:@"body" toAttribute:@"detailTextLabel.text"];
52+
cellMapping.cellClassName = @"RKGHIssueCell";
53+
cellMapping.reuseIdentifier = @"RKGHIssue";
54+
cellMapping.rowHeight = 100.0;
55+
[cellMapping mapKeyPath:@"title" toAttribute:@"titleLabel.text"];
56+
[cellMapping mapKeyPath:@"body" toAttribute:@"descriptionLabel.text"];
57+
[cellMapping mapKeyPath:@"number" toAttribute:@"issueNumber"];
58+
[cellMapping mapKeyPath:@"user.login" toAttribute:@"creatorName"];
59+
[cellMapping mapKeyPath:@"createdAgo" toAttribute:@"createdAgo"];
5260

5361
[tableController mapObjectsWithClass:[RKGHIssue class] toTableCellsWithMapping:cellMapping];
5462
}

0 commit comments

Comments
 (0)