I am trying to creating check list in a table view. Inside table view radio button and UILabel, here adding swipe gesture to UILabel. For single swipe of UILabel will show radio button or double swipe of UILabel will show dash line.
I have tried of adding gesture to UILabel inside table by using selector method, it print successfully but UILabel is not swiping.
Here is the code tried of swiping UILabel:
In viewDidLoad:
let gestureRec = UISwipeGestureRecognizer(target: self, action: #selector(didTap(sender:)))
tableView.addGestureRecognizer(gestureRec)
gestureRec.delegate = self as? UIGestureRecognizerDelegate
And created function called didTap:
@objc func didTap(sender : UISwipeGestureRecognizer)
{
if sender.state == .ended {
let location = sender.location(in: self.tableView)
let indexPath = self.tableView.indexPathForRow(at: location)
var cell = self.tableView.cellForRow(at: indexPath!) as! textCell
print("swipe")
cell.labelView.frame(forAlignmentRect: CGRect(x: 10, y: 8, width: 20,
height: 15))
}
}