Skip to content

Instantly share code, notes, and snippets.

@corinnekrych
Last active December 17, 2015 22:39
Show Gist options
  • Save corinnekrych/5683404 to your computer and use it in GitHub Desktop.
Save corinnekrych/5683404 to your computer and use it in GitHub Desktop.
- (ARCellData *)cellProject {
[self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:NSStringFromClass([UITableViewCell class])];
ARCellData *cellData = [[ARCellData alloc] initWithIdentifier:NSStringFromClass([UITableViewCell class])];
[cellData setCellConfigurationBlock:^(UITableViewCell *cell) {
//[cell setStyle:UITableViewCellStyleValue1];
cell.textLabel.text = @"Project";
cell.detailTextLabel.text = self.task[@"project"];
}];
return cellData;
}
... and internally ARGenricTableViewController
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
ARCellData *cellData = [self.tableViewData cellDataAtIndexPath:indexPath];
NSString *CellIdentifier = cellData.identifier;
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (!cell) {
Class TableViewClass = self.tableViewCellClassDict[CellIdentifier];
cell = [[TableViewClass alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
// Configure the cell...
if (cellData.cellConfigurationBlock) {
cellData.cellConfigurationBlock(cell);
}
return cell;
}
@corinnekrych
Copy link
Author

ARCellData *cellData = [[ARCellData alloc] initWithIdentifier:NSStringFromClass([UITableViewCell class]) andWithStyle:.....];

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment