I am trying to detect a click gesture on a UIImageView inside a UITableViewCell.
This is part of the code inside cellForRowAtIndexPath
:
let cell1 : cellTableViewCell = self.tableView.dequeueReusableCellWithIdentifier("cell") as! cellTableViewCell
tableView.allowsSelection = false
cell1.profileImg.userInteractionEnabled = true
let tappedOnImage = UIGestureRecognizer(target: cell1, action: "tappedOnImage:")
cell1.profileImg.tag = indexPath.row
cell1.profileImg.addGestureRecognizer(tappedOnImage)
And here is the function that processes the gesture:
func tappedOnImage(sender:UITapGestureRecognizer){
print("hey")
}
However, nothing happens when I use any suggestions?
source
share