YPDrawSignatureView - Table scrolling when drawing signature

Viewed 742

So I want a signature view within a table cell. Obviously whenever somebody tries to draw in the cell, the table scrolls.

How would I stop the scrolling but ONLY when the user is writing in the signature box?

3 Answers

I found better solution for this issue rather than putting button. Implement the delegate methods in viewController,

class mainVC: UIViewController,YPSignatureDelegate {

Than set delegate of signature view to this view controller

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
            let cell = tableView.dequeueReusableCell(withIdentifier: "SignatureCell", for: indexPath) as! SignatureCell
            cell.signatureView.delegate = self
            return cell
}

And then add these code. This are two delegates of YPSignature. Add in Main view controller

    func didStart() {
        tableView.isScrollEnabled = false
    }
    // didFinish() is called rigth after the last touch of a gesture is registered in the view.
    // Can be used to enabe scrolling in a scroll view if it has previous been disabled.
    func didFinish() {
        tableView.isScrollEnabled = true
    }
Related