I have a UITableView
and I want to add UILongPressGestureRecognizer
for each row.
I tried dragging the recognizer on the table cell and referencing an action for it, but that was never called.
I also tried
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: ident, for: indexPath) as! TableViewCell
/*...*/
var longGesture = UILongPressGestureRecognizer(target: self, action: #selector(FilterPickerViewController.longPress))
longGesture.minimumPressDuration = 1
cell.leftLabel.addGestureRecognizer(longGesture)
return cell
}
@objc func longPress(_ sender: UILongPressGestureRecognizer) {
print("press")
}
but that didn't work either. What am i doing wrong?