Skip to content

Instantly share code, notes, and snippets.

@mikekavouras
Last active February 25, 2016 02:28
Show Gist options
  • Select an option

  • Save mikekavouras/61ad0483f43b68c61887 to your computer and use it in GitHub Desktop.

Select an option

Save mikekavouras/61ad0483f43b68c61887 to your computer and use it in GitHub Desktop.
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell{
guard let cell = tableView.dequeueReusableCellWithIdentifier("roundsIdentifier", forIndexPath:indexPath) as? CustomRoundsTableViewCell else {
return UITableViewCell()
}
let round = roundsArray[indexPath.row]
cell.roundNumberLabel?.text = "Round \(round.value)"
cell.redScoreLabel?.text = String(round.redScore)
cell.blueScoreLabel?.text = String(round.blueScore)
let hasScore = round.redScore != 0 && round.blueScore != 0
cell.selectionStyle = hasScore ? .None : .Default
cell.userInteractionEnabled = !hasScore
cell.roundNumberLabel.enabled = !hasScore
cell.blueScoreLabel.enabled = !hasScore
cell.redScoreLabel.enabled = !hasScore
return cell
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment