I have a project with a few different VCs...two of them have TableViews
The first one works perfectly fine, I have a custom view in there etc.
The second one is also custom and it fill the information in just fine, but unlike the first one...I cannot tap on it to segue to the next VC
I have the Delegate and DataSource set up properly. I have another VC on my project with a tableview and it works just fine. The first thing I can think might be preventing it from working is a UILabel takes up 90% of the cell, but I don't think that is it because I made the label small and tried tapping then and it still wouldn't hit the breakpoint.
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let row = indexPath.row
selectedService = serviceArray[row].serviceID! as String
if selectedService != "" {
self.performSegue(withIdentifier: "fromCardDetailsToEditService", sender: self)
}
}
I do not know if it matters BUT...the VC that I am on is in a Tab Bar Controller and a Nav Bar Controller. Does it matter for the performSegue that I am in a Tab Bar? And that this button is not a tab bar item?
I figured out how to have my Gesture Recognizer AND the didSelectRowAt.
This is what I already had, which was causing conflict.
To fix it, this simple line let me dismiss the keyboard AND be able to tap on my cells.
Did you have any
GestureRecognizer
on yourUIViewController
because in case ofGestureRecognizer
tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath)
does not called.