Skip to content

Instantly share code, notes, and snippets.

@ksm
Forked from bunnyhero/ReusableCellExample.m
Created August 10, 2014 19:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ksm/508d2bf137e0f88f571e to your computer and use it in GitHub Desktop.
Save ksm/508d2bf137e0f88f571e 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