Skip to content

Instantly share code, notes, and snippets.

@vinhnx
Forked from bunnyhero/ReusableCellExample.m
Last active August 29, 2015 14:19
Show Gist options
  • Save vinhnx/69b1a316b4c1af37f729 to your computer and use it in GitHub Desktop.
Save vinhnx/69b1a316b4c1af37f729 to your computer and use it in GitHub Desktop.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell =
[tableView dequeueReusableCellWithIdentifier:REUSABLE_CELL_ID];
UILabel *label = (UILabel *)[cell viewWithTag:VIEW_TAG];
Model *someModel = [self getModelFromIndexPath:indexPath];
// `takeUntil:` makes the RACObserve() signal complete (and thus breaks the subscription)
// when the cell is recycled.
RAC(label, text) = [RACObserve(someModel, someKey)
takeUntil:cell.rac_prepareForReuseSignal];
return cell;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment