Skip to content

Instantly share code, notes, and snippets.

@perfectionist
Created January 18, 2012 20:44
Show Gist options
  • Save perfectionist/1635477 to your computer and use it in GitHub Desktop.
Save perfectionist/1635477 to your computer and use it in GitHub Desktop.
TableView Cell Reuse
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
cell.textLabel.text = [[self.dataSource recipeAtIndex:indexPath.row] title];
return cell;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment