Skip to content

Instantly share code, notes, and snippets.

@soggybag
Created December 10, 2015 15:21
Show Gist options
  • Save soggybag/930ae9af410862260d31 to your computer and use it in GitHub Desktop.
Save soggybag/930ae9af410862260d31 to your computer and use it in GitHub Desktop.
Zebra Striped cells
// Somewhere inside cellForRowAtIndexPath
// You could use this to color every other cell
// Use % 2 to find each odd numbered cell
if indexPath.row % 2 == 0 {
cell.backgroundColor = UIColor(hue: 0.43, saturation: 1.0, brightness: 0.75, alpha: 1.0)
} else {
cell.backgroundColor = UIColor(hue: 0.43, saturation: 1.0, brightness: 0.85, alpha: 1.0)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment