Skip to content

Instantly share code, notes, and snippets.

@bryanluby
Last active December 23, 2015 09:38
Show Gist options
  • Save bryanluby/6615420 to your computer and use it in GitHub Desktop.
Save bryanluby/6615420 to your computer and use it in GitHub Desktop.
Objc: Alternate the background color of a UITableViewCell.
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{
if (indexPath.row % 2 == 0) {
UIColor *altCellColor = [UIColor colorWithWhite:0.7 alpha:0.1];
cell.backgroundColor = altCellColor;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment