Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

YPDrawSignatureView - Table scrolling when drawing signature

Tags:

scroll

swift

cell

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?

like image 631
e4stwood Avatar asked Feb 07 '23 13:02

e4stwood


1 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
    }
like image 126
hardik hadwani Avatar answered Mar 24 '23 09:03

hardik hadwani