Skip to content

Instantly share code, notes, and snippets.

@kulte
Created December 7, 2012 23:56
Show Gist options
  • Save kulte/4237643 to your computer and use it in GitHub Desktop.
Save kulte/4237643 to your computer and use it in GitHub Desktop.
iOS Recipes 15-1
static NSString *CellID = @"CustomCell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellID];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellID];
UIImage *rainbow = [UIImage imageNamed:@"rainbow"];
UIImageView *mainImageView = [[UIImageView alloc] initWithImage:rainbow];
UIImageView *otherImageView = [[UIImageView alloc] initWithImage:rainbow];
CGRect iconFrame = (CGRect) { { 12.0, 4.0 }, rainbow.size };
mainImageView.frame = iconFrame;
iconFrame.origin.x = CGRectGetMaxX(iconFrame) + 9.0;
otherImageView.frame = iconFrame;
[cell.contentView addSubview:mainImageView];
[cell.contentView addSubview:otherImageView];
UILabel *label = [[UILabel alloc] initWithFrame:labelFrame];
[cell.contentView addSubview:label];
}
return cell;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment