I have a custom UITableViewCell with a UITapGestureRecognizer on a UILabel which segues to a new view controller. When the tap gesture occurs, the segue works, but always passes data from the only first cell, regardless of which cell the tapGesture is performed in. However, when I first select a cell outside of the label tapGestureRecognizer, and then perform the tap gesture, the data passes successfully b/c I first selected the respective cell.
How can I set the tapGesture to also recognize the cell selection?
P.S. I set up the gesture and segue in storyboard, not code. Also, my data passing code is my prepareForSegue method.
You’re question is a bit light on details, but let me ask: are you determining in your code which cell was selected when the tap occurs?
ie. In your method that fires when a tap occurs, check which cell the tap occurred in by querying the tableview, and from that you can determine which code you need to pass in your prepareForSegue method.
For example, I use this method below to determine which cell was tapped on, and bring up the keyboard for the textfield of that cell. You can easily adapt this to store away which cell was tapped on, then use it in your prepareForSegue to send the right data.
Hope this is what you are looking for. Can’t quite tell from your question though!