In my Xcode project I want to create a segue from tapping on an image in a cell in a tableview. I have search around for an answer and the most relevant one was to change the image view to a button. This solution unfortunately does not work with my project because I have the image view customized in a certain way I want for when a image is in it.
So now I am in desperate need of help. I have a button with text in another cell that performs the same segue I want. It gets the objectID that I put in that cell and appends it to a global variable so when the other view appears, it will take that objectID and do the necessary functions. I have copied the code for that button below:
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "PostCell") as! Cell1
cell.textButton.layer.setValue(indexPath, forKey: "index")
return cell
}
@IBAction func textPressed(_ sender: Any) {
let index = (sender as AnyObject).layer.value(forKey: "index") as! IndexPath
let cell = tableView.cellForRow(at: index) as! Cell1
globalText.append(cell.objectID)
let text = self.storyboard?.instantiateViewController(withIdentifier: "TextVC") as! TextVC
self.navigationController?.pushViewController(text, animated: true)
}
Now I just need to know how to do this exact same thing but for a imageview in a cell. Can someone please help?