Last active
November 19, 2015 03:37
-
-
Save ctrevarthen/494b0b003fc13ab92022 to your computer and use it in GitHub Desktop.
ShopQuick - Shopping List VC - Strikethru
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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