I have a tableView with custom tableViewCell. Each cell has an image on the left (see screen 1). The custom tableViewCell has been subclassed. Every row has a different image which depends on indexPath.row
If I click on the image(s) the screen, the images should change to tick boxes so user can multiselect (see screen 2). If I click back on the image with a tick, it should revert back to old image on screen 1.
Issue : I know how to change the image to tick mark but don't know how to go back to old image (pls remember every row has a different image - so the "else" part in my below code will not make sense).
Below is my code to change and revert the image
@IBAction func imageTap(sender: AnyObject) {
let imageView : UIImageView! = sender.view! as! UIImageView
if imageView.image != UIImage(named: "Oval 5"){
imageView.image = UIImage(named: "Oval 5")
awardBadge.hidden = false
}
else // Need to figure out how to go back to same image
{
imageView.image = UIImage(named: "Oval 1")
awardBadge.hidden = true
}
}
Aucun commentaire:
Enregistrer un commentaire