Skip to content

Instantly share code, notes, and snippets.

@soggybag
Created November 13, 2015 06:27
Show Gist options
  • Save soggybag/45604c2771c569a7a049 to your computer and use it in GitHub Desktop.
Save soggybag/45604c2771c569a7a049 to your computer and use it in GitHub Desktop.
UITableViewCell accessory view. Using an image for the accessory view.
func completeRowAtIndexPath(indexPath: NSIndexPath) {
print("Completing row: \(indexPath.row)")
let cell = tableView.cellForRowAtIndexPath(indexPath)
let todo = array[indexPath.row]
todo.completed = !todo.completed
if todo.completed {
// cell?.accessoryType = .Checkmark
let ribbon = UIImage(named: "Ribbon")
cell?.accessoryView = UIImageView(image: ribbon)
} else {
cell?.accessoryType = .None
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment