Skip to content

Instantly share code, notes, and snippets.

@ctrevarthen
Last active November 19, 2015 03:37
Show Gist options
  • Save ctrevarthen/494b0b003fc13ab92022 to your computer and use it in GitHub Desktop.
Save ctrevarthen/494b0b003fc13ab92022 to your computer and use it in GitHub Desktop.
ShopQuick - Shopping List VC - Strikethru
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
if let cell = tableView.dequeueReusableCellWithIdentifier("Product Cell") as? ProductCell {
let product = self.shoppingListManager.productAtIndex(indexPath.row)
if product.purchased {
let attr = [NSStrikethroughStyleAttributeName: NSUnderlineStyle.StyleSingle.rawValue]
let attrString = NSAttributedString(string: product.name, attributes: attr)
cell.productNameLabel.attributedText = attrString
}
else {
cell.productNameLabel.text = product.name
}
cell.delegate = self
cell.leftUtilityButtons = self.leftButtonsForProduct(product)
cell.rightUtilityButtons = self.rightButtons()
return cell
}
return UITableViewCell()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment